diff mbox

[v2] malloc: remove redundant getenv call

Message ID 20151124164701.GE25138@glebfm.cloud.tilaa.com
State New
Headers show

Commit Message

Gleb Fotengauer-Malinovskiy Nov. 24, 2015, 4:47 p.m. UTC
* malloc/memusage.c (me): Remove redundant getenv call.
---
 malloc/memusage.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

2015-11-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	* malloc/memusage.c (me): Remove redundant getenv call.

--
glebfm

Comments

Florian Weimer Nov. 24, 2015, 4:51 p.m. UTC | #1
On 11/24/2015 05:47 PM, Gleb Fotengauer-Malinovskiy wrote:
> * malloc/memusage.c (me): Remove redundant getenv call.
> ---
>  malloc/memusage.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> 2015-11-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
> 
> 	* malloc/memusage.c (me): Remove redundant getenv call.

Looks good to me.

Can you commit this yourself?

Thanks,
Florian
Gleb Fotengauer-Malinovskiy Nov. 24, 2015, 5:41 p.m. UTC | #2
On Tue, Nov 24, 2015 at 05:51:08PM +0100, Florian Weimer wrote:
> On 11/24/2015 05:47 PM, Gleb Fotengauer-Malinovskiy wrote:
> > * malloc/memusage.c (me): Remove redundant getenv call.
> > ---
> >  malloc/memusage.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > 2015-11-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
> > 
> > 	* malloc/memusage.c (me): Remove redundant getenv call.
> 
> Looks good to me.
> 
> Can you commit this yourself?

Not yet. Dmitry have pushed it.
diff mbox

Patch

diff --git a/malloc/memusage.c b/malloc/memusage.c
index a57ba8e..6de3344 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -276,9 +276,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)
+              const char *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;
                 }