diff options
author | Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> | 2013-05-04 20:18:35 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-05-20 11:01:50 -0600 |
commit | a96bc63507f57f3547f982d5e9a8b95f68e87e3b (patch) | |
tree | 8a810ccaeeb1caff211827cace9536d340085c7e /util.c | |
parent | 7ccde1209c3d4319a2e0ab9a4528f6abc8eec0d2 (diff) | |
download | perl-a96bc63507f57f3547f982d5e9a8b95f68e87e3b.tar.gz |
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
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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'; |