From a96bc63507f57f3547f982d5e9a8b95f68e87e3b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Sat, 4 May 2013 20:18:35 -0600 Subject: [PATCH] perl #117865] [PATCH] Eliminate useless variable and sizeof(char) bufsiz is always just set from bsiz (via a useless multiplication by sizeof(char), which is by definition 1), so instead of trying to keep them in sync, just get rid of bufsiz use bsiz directly# Please enter the commit message for your changes. Lines starting --- util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/util.c b/util.c index da5959f..14d9f2c 100644 --- a/util.c +++ b/util.c @@ -6143,16 +6143,14 @@ Perl_my_clearenv(pTHX) (void)clearenv(); # elif defined(HAS_UNSETENV) int bsiz = 80; /* Most envvar names will be shorter than this. */ - int bufsiz = bsiz * sizeof(char); /* sizeof(char) paranoid? */ - char *buf = (char*)safesysmalloc(bufsiz); + char *buf = (char*)safesysmalloc(bsiz); while (*environ != NULL) { char *e = strchr(*environ, '='); int l = e ? e - *environ : (int)strlen(*environ); if (bsiz < l + 1) { (void)safesysfree(buf); bsiz = l + 1; /* + 1 for the \0. */ - bufsiz = bsiz * sizeof(char); /* keep bsiz and bufsiz in sync */ - buf = (char*)safesysmalloc(bufsiz); + buf = (char*)safesysmalloc(bsiz); } memcpy(buf, *environ, l); buf[l] = '\0'; -- 2.7.4