X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=fast-import.c;h=3276d5d7aa49aaf41cf9f9e3562a5bbd14b63c18;hb=2fad5329f4bc03e2328a2994d336c12a9683d9b2;hp=3c035a57886329acf4d53a600af0a82ee55d514b;hpb=6e13921b4f7adcc7316a76c0c4955b85b1589a65;p=git.git diff --git a/fast-import.c b/fast-import.c index 3c035a578..3276d5d7a 100644 --- a/fast-import.c +++ b/fast-import.c @@ -554,6 +554,10 @@ static void *pool_alloc(size_t len) struct mem_pool *p; void *r; + /* round up to a 'uintmax_t' alignment */ + if (len & (sizeof(uintmax_t) - 1)) + len += sizeof(uintmax_t) - (len & (sizeof(uintmax_t) - 1)); + for (p = mem_pool; p; p = p->next_pool) if ((p->end - p->next_free >= len)) break; @@ -572,9 +576,6 @@ static void *pool_alloc(size_t len) } r = p->next_free; - /* round out to a 'uintmax_t' alignment */ - if (len & (sizeof(uintmax_t) - 1)) - len += sizeof(uintmax_t) - (len & (sizeof(uintmax_t) - 1)); p->next_free += len; return r; }