win32_freeenvironmentstrings: convert nonpublic exported function to macro
authorDaniel Dragan <bulk88@hotmail.com>
Sun, 14 Oct 2012 19:30:01 +0000 (15:30 -0400)
committerSteve Hay <steve.m.hay@googlemail.com>
Wed, 17 Oct 2012 10:36:46 +0000 (11:36 +0100)
win32_freeenvironmentstrings was added in commit 4f46e52b008. It is not
documented as public api but is exported. Since it is nothing more than a
renaming of win32_free, replace it with a macro to win32_free. This saves
an entry in the export table, and the string name of the export from
perl517.dll. Also see
http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/msg192954.html

win32/win32.c
win32/win32iop.h

index 3ee85a1..bfc02fd 100644 (file)
@@ -1746,6 +1746,10 @@ win32_ansipath(const WCHAR *widename)
     return name;
 }
 
+/* the returned string must be freed with win32_freeenvironmentstrings which is
+ * implemented as a macro
+ * void win32_freeenvironmentstrings(void* block)
+ */
 DllExport char *
 win32_getenvironmentstrings(void)
 {
@@ -1775,12 +1779,6 @@ win32_getenvironmentstrings(void)
     return(lpStr);
 }
 
-DllExport void
-win32_freeenvironmentstrings(void* block)
-{
-    win32_free(block);
-}
-
 DllExport char *
 win32_getenv(const char *name)
 {
index caf87ae..207c917 100644 (file)
@@ -123,7 +123,7 @@ DllExport  int              win32_closedir(DIR *dirp);
 DllExport  DIR*                win32_dirp_dup(DIR *const dirp, CLONE_PARAMS *const param);
 
 DllExport  char*        win32_getenvironmentstrings(void);
-DllExport  void         win32_freeenvironmentstrings(void *block);
+/* also see win32_freeenvironmentstrings macro */
 DllExport  char*       win32_getenv(const char *name);
 DllExport  int         win32_putenv(const char *name);
 
@@ -160,6 +160,8 @@ DllExport Sighandler_t      win32_signal(int sig, Sighandler_t subcode);
 
 END_EXTERN_C
 
+/* see comment in win32_getenvironmentstrings */
+#define win32_freeenvironmentstrings(x) win32_free(x)
 #undef alarm
 #define alarm                          win32_alarm
 #undef strerror