develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34202 - trunk/config/gen/platform/win32

From:
Whiteknight
Date:
December 21, 2008 06:52
Subject:
[svn:parrot] r34202 - trunk/config/gen/platform/win32
Message ID:
20081221145220.09D36CBA12@x12.develooper.com
Author: Whiteknight
Date: Sun Dec 21 06:52:19 2008
New Revision: 34202

Modified:
   trunk/config/gen/platform/win32/env.c

Log:
[win32] Take a stab at resolving RT#48276, + a few small upgrades

Modified: trunk/config/gen/platform/win32/env.c
==============================================================================
--- trunk/config/gen/platform/win32/env.c	(original)
+++ trunk/config/gen/platform/win32/env.c	Sun Dec 21 06:52:19 2008
@@ -54,17 +54,12 @@
         const int value_len = strlen(value);
 
         {
-            char * const envstring = malloc(
+            char * const envstring = mem_internal_allocate(
                     name_len     /* name  */
                     + 1          /* '='   */
                     + value_len  /* value */
                     + 1);        /* string terminator */
 
-            if (envstring == NULL) {
-                /* RT#48276: Shouldn't we tell anyone that we failed? */
-                return;
-            }
-
             /* Save a bit of time, by using the fact we already have the
             lengths, avoiding strcat */
             strcpy(envstring, name);
@@ -73,11 +68,13 @@
 
             if (_putenv(envstring) == 0) {
                 /* success */
+                mem_sys_free(envstring);
             }
             else {
-                /* RT#48276: Shouldn't we tell anyone that we failed? */
+                mem_sys_free(envstring);
+                exit_fatal(1, "Unable to set environment variable %s=%s",
+                    name, value);
             }
-            free(envstring);
         }
     }
 }



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About