build: optimize with -O2 by default
also make the array code more explicit to have gcc optimizer happy.cute-signatures
parent
f1985b03bd
commit
e00f5ea74a
|
@ -67,7 +67,7 @@ LD := $(CROSS_COMPILE)ld
|
||||||
INSTALL := install
|
INSTALL := install
|
||||||
INSTALLDIR := $(INSTALL) -d
|
INSTALLDIR := $(INSTALL) -d
|
||||||
|
|
||||||
CFLAGS ?= -g
|
CFLAGS ?= -g -O2
|
||||||
CFLAGS_ALL := -Werror -Wall -Wstrict-prototypes -D_GNU_SOURCE -std=gnu99
|
CFLAGS_ALL := -Werror -Wall -Wstrict-prototypes -D_GNU_SOURCE -std=gnu99
|
||||||
CFLAGS_ALL += $(CFLAGS)
|
CFLAGS_ALL += $(CFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -83,12 +83,13 @@ typedef void (*apk_progress_cb)(void *cb_ctx, size_t);
|
||||||
{ \
|
{ \
|
||||||
struct array_type_name *tmp; \
|
struct array_type_name *tmp; \
|
||||||
int oldnum = a ? a->num : 0; \
|
int oldnum = a ? a->num : 0; \
|
||||||
|
int diff = size - oldnum; \
|
||||||
tmp = (struct array_type_name *) \
|
tmp = (struct array_type_name *) \
|
||||||
realloc(a, sizeof(struct array_type_name) + \
|
realloc(a, sizeof(struct array_type_name) + \
|
||||||
size * sizeof(elem_type_name)); \
|
size * sizeof(elem_type_name)); \
|
||||||
if (size > oldnum) \
|
if (diff > 0) \
|
||||||
memset(&tmp->item[oldnum], 0, \
|
memset(&tmp->item[oldnum], 0, \
|
||||||
(size - oldnum) * sizeof(a->item[0])); \
|
diff * sizeof(a->item[0])); \
|
||||||
tmp->num = size; \
|
tmp->num = size; \
|
||||||
return tmp; \
|
return tmp; \
|
||||||
} \
|
} \
|
||||||
|
|
Loading…
Reference in New Issue