This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
mallopt indentation bug?
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Tue, 04 Sep 2012 20:28:58 -0300
- Subject: 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