This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: remove redundant getenv call
- From: Gleb Fotengauer-Malinovskiy <glebfm at altlinux dot org>
- To: libc-alpha at sourceware dot org
- Date: Tue, 24 Nov 2015 19:26:55 +0300
- Subject: [PATCH] malloc: remove redundant getenv call
- Authentication-results: sourceware.org; auth=none
* malloc/memusage.c (me): Remove redundant getenv call.
---
malloc/memusage.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/malloc/memusage.c b/malloc/memusage.c
index a57ba8e..68903bc 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -265,6 +265,8 @@ me (void)
not_me = true;
else
{
+ const char *str_buffer_size;
+
/* Write the first entry. */
first.heap = 0;
first.stack = 0;
@@ -276,9 +278,10 @@ me (void)
/* Determine the buffer size. We use the default if the
environment variable is not present. */
buffer_size = DEFAULT_BUFFER_SIZE;
- if (getenv ("MEMUSAGE_BUFFER_SIZE") != NULL)
+ str_buffer_size = getenv ("MEMUSAGE_BUFFER_SIZE");
+ if (str_buffer_size != NULL)
{
- buffer_size = atoi (getenv ("MEMUSAGE_BUFFER_SIZE"));
+ buffer_size = atoi (str_buffer_size);
if (buffer_size == 0 || buffer_size > DEFAULT_BUFFER_SIZE)
buffer_size = DEFAULT_BUFFER_SIZE;
}
--
glebfm