]> granicus.if.org Git - gc/commitdiff
Minor code refactoring of GC_allochblk_nth
authorIvan Maidanski <ivmai@mail.ru>
Wed, 17 Oct 2012 17:58:38 +0000 (21:58 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 17 Oct 2012 17:58:38 +0000 (21:58 +0400)
* allchblk.c (GC_allochblk_nth): Simplify code in the loop (which
allocates and drops the block in small chunks) by first calling
GC_install_header if h != hbp (instead of calling it a conditional
expression) and, then, calling setup_header if hhdr is non-NULL.

allchblk.c

index 4a13de4ad452a1436d20fc2882213889e2ef7fc1..b4879389035300d2c1acb1983f1337b8ba2d3d83 100644 (file)
@@ -751,11 +751,12 @@ GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n, int may_split)
                       GC_bytes_dropped += total_size;
                       GC_remove_from_fl_at(hhdr, n);
                       for (h = hbp; (word)h < (word)limit; h++) {
-                        if (h == hbp || 0 != (hhdr = GC_install_header(h))) {
-                          (void) setup_header(
-                                  hhdr, h,
-                                  HBLKSIZE,
-                                  PTRFREE, 0); /* Can't fail */
+                        if (h != hbp) {
+                          hhdr = GC_install_header(h);
+                        }
+                        if (NULL != hhdr) {
+                          (void)setup_header(hhdr, h, HBLKSIZE, PTRFREE, 0);
+                                                    /* Can't fail. */
                           if (GC_debugging_started) {
                             BZERO(h, HBLKSIZE);
                           }