all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25331: [PATCH] Unwrap single statement code blocks
@ 2017-01-02  8:19 Chris Gregory
  2017-01-07  8:32 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Gregory @ 2017-01-02  8:19 UTC (permalink / raw)
  To: 25331

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;
 }





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-07  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-02  8:19 bug#25331: [PATCH] Unwrap single statement code blocks Chris Gregory
2017-01-07  8:32 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.