summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-01-15 06:54:23 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-01-15 06:54:23 -0800
commitf3779c9ee17b215a8733a07b69117ff4af3be150 (patch)
tree144bd1f7bf1a159f7c247fa8817b8af56a1dad92
parentbf28aac4317f6ff020a42cef5ed4f30010357bef (diff)
downloadtxr-f3779c9ee17b215a8733a07b69117ff4af3be150.tar.gz
txr-f3779c9ee17b215a8733a07b69117ff4af3be150.tar.bz2
txr-f3779c9ee17b215a8733a07b69117ff4af3be150.zip
ffi: remove useless loop.
* ffi.c (make_ffi_type_array): Remove a useless loop that was left behind when the essential part of its body was removed.
-rw-r--r--ffi.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/ffi.c b/ffi.c
index 9f07ad27..fc21c7de 100644
--- a/ffi.c
+++ b/ffi.c
@@ -3066,7 +3066,7 @@ static val make_ffi_type_array(val syntax, val lisp_type,
struct txr_ffi_type *tft = coerce(struct txr_ffi_type *,
chk_calloc(1, sizeof *tft));
ffi_type *ft = coerce(ffi_type *, chk_calloc(1, sizeof *ft));
- cnum nelem = c_num(dim), i;
+ cnum nelem = c_num(dim);
val obj = cobj(coerce(mem_t *, tft), ffi_type_s, &ffi_type_struct_ops);
struct txr_ffi_type *etft = ffi_type_struct(eltype);
@@ -3088,21 +3088,15 @@ static val make_ffi_type_array(val syntax, val lisp_type,
tft->alloc = ffi_fixed_alloc;
tft->free = free;
tft->by_value_in = etft->by_value_in;
-
- for (i = 0; i < nelem; i++) {
- if (i == 0) {
- tft->size = etft->size * nelem;
- tft->align = etft->align;
- if (etft->out != 0)
- tft->out = ffi_array_out;
- }
- }
-
+ tft->size = etft->size * nelem;
+ tft->align = etft->align;
+ if (etft->out != 0)
+ tft->out = ffi_array_out;
tft->nelem = nelem;
#if HAVE_LIBFFI
ft->type = FFI_TYPE_STRUCT;
- ft->size = etft->size * nelem;
+ ft->size = tft->size;
ft->alignment = etft->align;
ft->elements = tft->elements;
#endif