This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mallopt indentation bug?


The assignment to no_dyn_threshold is indented as if it was meant to be
run only in the else branch, but since C is not Python, it's run
unconditionally.  That's not necessarily a bug, but since indentation is
misleading here, I figured I'd better fix it one way or the other, and I
decided to add braces to match the intent implied by indentation, rather
than reindent.

Patch pushed to lxoliva/malloc-probes-bz742038.  Ok for master?

for ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* malloc/malloc.c (__libc_mallopt) <M_MMAP_THRESHOLD>: Do not
	change internal state upon failure.
---

 malloc/malloc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0f1796c..dd83551 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4766,8 +4766,10 @@ int __libc_mallopt(int param_number, int value)
     if((unsigned long)value > HEAP_MAX_SIZE/2)
       res = 0;
     else
-      mp_.mmap_threshold = value;
-      mp_.no_dyn_threshold = 1;
+      {
+	mp_.mmap_threshold = value;
+	mp_.no_dyn_threshold = 1;
+      }
     break;
 
   case M_MMAP_MAX:


-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]