summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6bd4d0f)
raw | patch | inline | side by side (parent: 6bd4d0f)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 18 Feb 2009 11:09:12 +0000 (12:09 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 18 Feb 2009 14:14:52 +0000 (15:14 +0100) |
Comparing the size of the binary before and after this change, shows
that the size does not increase when -02 is used.
that the size does not increase when -02 is used.
tig.c | patch | blob | history |
index 16b0df20aba44d1cb208d2937807810d96446617..5acb3988098720a0748b39380e778e61202bed4e 100644 (file)
--- a/tig.c
+++ b/tig.c
static struct run_request *run_request;
static size_t run_requests;
+DEFINE_ALLOCATOR(realloc_run_requests, struct run_request, 8)
+
static enum request
add_run_request(enum keymap keymap, int key, int argc, const char **argv)
{
if (argc >= ARRAY_SIZE(req->argv) - 1)
return REQ_NONE;
- req = realloc(run_request, (run_requests + 1) * sizeof(*run_request));
- if (!req)
+ if (!realloc_run_requests(&run_request, run_requests, 1))
return REQ_NONE;
- run_request = req;
req = &run_request[run_requests];
req->keymap = keymap;
req->key = key;