diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-07-14 11:01:03 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-07-14 11:01:03 +0300 |
commit | e00f5ea74a448c1148725794d89a4149b98fdb11 (patch) | |
tree | b7aa19538679b3478c614863129b27c5f8d1d01c /src/apk_defines.h | |
parent | f1985b03bdf77c049cc28b25fe6275867c25ba49 (diff) | |
download | apk-tools-e00f5ea74a448c1148725794d89a4149b98fdb11.tar.gz apk-tools-e00f5ea74a448c1148725794d89a4149b98fdb11.tar.bz2 apk-tools-e00f5ea74a448c1148725794d89a4149b98fdb11.tar.xz apk-tools-e00f5ea74a448c1148725794d89a4149b98fdb11.zip |
build: optimize with -O2 by default
also make the array code more explicit to have gcc optimizer happy.
Diffstat (limited to 'src/apk_defines.h')
-rw-r--r-- | src/apk_defines.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/apk_defines.h b/src/apk_defines.h index 755d971..49ca9eb 100644 --- a/src/apk_defines.h +++ b/src/apk_defines.h @@ -83,12 +83,13 @@ typedef void (*apk_progress_cb)(void *cb_ctx, size_t); { \ struct array_type_name *tmp; \ int oldnum = a ? a->num : 0; \ + int diff = size - oldnum; \ tmp = (struct array_type_name *) \ realloc(a, sizeof(struct array_type_name) + \ size * sizeof(elem_type_name)); \ - if (size > oldnum) \ + if (diff > 0) \ memset(&tmp->item[oldnum], 0, \ - (size - oldnum) * sizeof(a->item[0])); \ + diff * sizeof(a->item[0])); \ tmp->num = size; \ return tmp; \ } \ |