Subject: bug#25331: [PATCH] Unwrap single statement code blocks

From: Chris Gregory <[email-masked]>
Date: Mon, 02 Jan 2017 00:19:26 -0800

This patch changes many blocks that look like:

    if (x)
      {
        statement;
      }

to

    if (x)
      statement;
-- 
Chris Gregory

diff --git a/src/ralloc.c b/src/ralloc.c
index 8a3d2b797f..0e1c2e41c5 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -178,10 +178,8 @@ find_heap (void *address)
   heap_ptr heap;
 
   for (heap = last_heap; heap; heap = heap->prev)
-    {
-      if (heap->start <= address && address <= heap->end)
-	return heap;
-    }
+    if (heap->start <= address && address <= heap->end)
+      return heap;
 
   return NIL_HEAP;
 }
@@ -212,10 +210,8 @@ obtain (void *address, size_t size)
 
   /* Find the heap that ADDRESS falls within.  */
   for (heap = last_heap; heap; heap = heap->prev)
-    {
-      if (heap->start <= address && address <= heap->end)
-	break;
-    }
+    if (heap->start <= address && address <= heap->end)
+      break;
 
   if (! heap)
     emacs_abort ();
@@ -295,10 +291,8 @@ relinquish (void)
      in all heaps which have extend beyond break_value at all.  */
 
   for (h = last_heap; h && break_value < h->end; h = h->prev)
-    {
-      excess += (char *) h->end - (char *) ((break_value < h->bloc_start)
-					    ? h->bloc_start : break_value);
-    }
+    excess += (char *) h->end - (char *) ((break_value < h->bloc_start)
+					  ? h->bloc_start : break_value);
 
   if (excess > extra_bytes * 2 && real_morecore (0) == last_heap->end)
     {
@@ -564,10 +558,8 @@ resize_bloc (bloc_ptr bloc, size_t size)
     return 1;
 
   for (heap = first_heap; heap != NIL_HEAP; heap = heap->next)
-    {
-      if (heap->bloc_start <= bloc->data && bloc->data <= heap->end)
-	break;
-    }
+    if (heap->bloc_start <= bloc->data && bloc->data <= heap->end)
+      break;
 
   if (heap == NIL_HEAP)
     emacs_abort ();
@@ -663,9 +655,7 @@ free_bloc (bloc_ptr bloc)
   resize_bloc (bloc, 0);
 
   if (bloc == first_bloc && bloc == last_bloc)
-    {
-      first_bloc = last_bloc = NIL_BLOC;
-    }
+    first_bloc = last_bloc = NIL_BLOC;
   else if (bloc == last_bloc)
     {
       last_bloc = bloc->prev;
@@ -858,10 +848,8 @@ r_alloc_sbrk (ptrdiff_t size)
 	}
 
       if ((char *) virtual_break_value + size < (char *) first_heap->start)
-	{
-	  /* We found an additional space below the first heap */
-	  first_heap->start = (void *) ((char *) virtual_break_value + size);
-	}
+	/* We found an additional space below the first heap */
+	first_heap->start = (void *) ((char *) virtual_break_value + size);
     }
 
   virtual_break_value = (void *) ((char *) address + size);
@@ -990,11 +978,8 @@ r_re_alloc (void **ptr, size_t size)
           else
 	    return NULL;
 	}
-      else
-	{
-	  if (! resize_bloc (bloc, MEM_ROUNDUP (size)))
-	    return NULL;
-        }
+      else if (! resize_bloc (bloc, MEM_ROUNDUP (size)))
+	return NULL;
     }
   return *ptr;
 }