Print this page
Code review comments from jeffpc

@@ -120,11 +120,11 @@
 {
         uintptr_t old_brk;
         uintptr_t ret_brk;
         uintptr_t high_brk;
         uintptr_t new_brk;
-        int brk_result;
+        intptr_t brk_result;
 
         if (!primary_link_map) {
                 errno = ENOTSUP;
                 return ((void *)-1);
         }

@@ -136,13 +136,12 @@
         low_align = MAX(low_align, ALIGNSZ);
         high_align = MAX(high_align, ALIGNSZ);
 
         lmutex_lock(&__sbrk_lock);
 
-        if (_nd == NULL) {
+        if (_nd == NULL)
                 _nd = (void *)_brk_unlocked(0);
-        }
 
         old_brk = (uintptr_t)BRKALIGN(_nd);
         ret_brk = P2ROUNDUP(old_brk, low_align);
         high_brk = ret_brk + min_size;
         new_brk = P2ROUNDUP(high_brk, high_align);

@@ -154,11 +153,11 @@
                 lmutex_unlock(&__sbrk_lock);
                 errno = ENOMEM;
                 return ((void *)-1);
         }
 
-        if ((brk_result = (int)_brk_unlocked((void *)new_brk)) == 0)
+        if ((brk_result = _brk_unlocked((void *)new_brk)) == 0)
                 _nd = (void *)new_brk;
         lmutex_unlock(&__sbrk_lock);
 
         if (brk_result != 0)
                 return ((void *)-1);

@@ -169,11 +168,11 @@
 }
 
 int
 brk(void *new_brk)
 {
-        int result;
+        intptr_t result;
 
         /*
          * brk(2) will return the current brk if given an argument of 0, so we
          * need to fail it here
          */

@@ -190,11 +189,11 @@
          * Need to align this here;  _brk_unlocked won't do it for us.
          */
         new_brk = BRKALIGN(new_brk);
 
         lmutex_lock(&__sbrk_lock);
-        if ((result = (int)_brk_unlocked(new_brk)) == 0)
+        if ((result = _brk_unlocked(new_brk)) == 0)
                 _nd = new_brk;
         lmutex_unlock(&__sbrk_lock);
 
         return (result);
 }