[Vala] Redundant C code



Hello.
(sorry, my English is not so good ;)

When I convert the following code into C language.

----------------
void main () {
  int[] a = { };
  a += 1;
  a += 1;
}
----------------

It is converted into a redundant following C code.

----------------
static void _vala_array_add1 (gint** array, int* length, int* size, gint value) {
        if ((*length) == (*size)) {
                *size = (*size) ? (2 * (*size)) : 4;
                *array = g_renew (gint, *array, *size);
        }
        (*array)[(*length)++] = value;
}

static void _vala_array_add2 (gint** array, int* length, int* size, gint value) {
        if ((*length) == (*size)) {
                *size = (*size) ? (2 * (*size)) : 4;
                *array = g_renew (gint, *array, *size);
        }
        (*array)[(*length)++] = value;
}
----------------

I think enough by one.

-- 
Kentaro NAKAZAWA



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]