This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl #117865] [PATCH] Eliminate useless variable and sizeof(char)
[perl5.git] / util.c
diff --git a/util.c b/util.c
index da5959f..14d9f2c 100644 (file)
--- 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';