Handle atexit list internaly for unthreaded builds
[gitweb.git] / shallow.c
index de07709e3358947062984970e85005ded224baf9..0cc3d47634b675bc25cb2936987fffe2f7d0518d 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -226,7 +226,6 @@ static void remove_temporary_shallow_on_signal(int signo)
 
 const char *setup_temporary_shallow(const struct sha1_array *extra)
 {
-       static int installed_handler;
        struct strbuf sb = STRBUF_INIT;
        int fd;
 
@@ -237,10 +236,8 @@ const char *setup_temporary_shallow(const struct sha1_array *extra)
                strbuf_addstr(&temporary_shallow, git_path("shallow_XXXXXX"));
                fd = xmkstemp(temporary_shallow.buf);
 
-               if (!installed_handler) {
-                       atexit(remove_temporary_shallow);
-                       sigchain_push_common(remove_temporary_shallow_on_signal);
-               }
+               atexit(remove_temporary_shallow);
+               sigchain_push_common(remove_temporary_shallow_on_signal);
 
                if (write_in_full(fd, sb.buf, sb.len) != sb.len)
                        die_errno("failed to write to %s",
@@ -392,8 +389,7 @@ static uint32_t *paint_alloc(struct paint_info *info)
        void *p;
        if (!info->slab_count || info->free + size > info->end) {
                info->slab_count++;
-               info->slab = xrealloc(info->slab,
-                                     info->slab_count * sizeof(*info->slab));
+               REALLOC_ARRAY(info->slab, info->slab_count);
                info->free = xmalloc(COMMIT_SLAB_SIZE);
                info->slab[info->slab_count - 1] = info->free;
                info->end = info->free + COMMIT_SLAB_SIZE;