Skip to content

Commit 2c8ca68

Browse files
bulk88steve-m-hay
authored andcommitted
win32_freeenvironmentstrings: convert nonpublic exported function to macro
win32_freeenvironmentstrings was added in commit 4f46e52. 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
1 parent ba71441 commit 2c8ca68

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

win32/win32.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,10 @@ win32_ansipath(const WCHAR *widename)
17461746
return name;
17471747
}
17481748

1749+
/* the returned string must be freed with win32_freeenvironmentstrings which is
1750+
* implemented as a macro
1751+
* void win32_freeenvironmentstrings(void* block)
1752+
*/
17491753
DllExport char *
17501754
win32_getenvironmentstrings(void)
17511755
{
@@ -1775,12 +1779,6 @@ win32_getenvironmentstrings(void)
17751779
return(lpStr);
17761780
}
17771781

1778-
DllExport void
1779-
win32_freeenvironmentstrings(void* block)
1780-
{
1781-
win32_free(block);
1782-
}
1783-
17841782
DllExport char *
17851783
win32_getenv(const char *name)
17861784
{

win32/win32iop.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ DllExport int win32_closedir(DIR *dirp);
123123
DllExport DIR* win32_dirp_dup(DIR *const dirp, CLONE_PARAMS *const param);
124124

125125
DllExport char* win32_getenvironmentstrings(void);
126-
DllExport void win32_freeenvironmentstrings(void *block);
126+
/* also see win32_freeenvironmentstrings macro */
127127
DllExport char* win32_getenv(const char *name);
128128
DllExport int win32_putenv(const char *name);
129129

@@ -160,6 +160,8 @@ DllExport Sighandler_t win32_signal(int sig, Sighandler_t subcode);
160160

161161
END_EXTERN_C
162162

163+
/* see comment in win32_getenvironmentstrings */
164+
#define win32_freeenvironmentstrings(x) win32_free(x)
163165
#undef alarm
164166
#define alarm win32_alarm
165167
#undef strerror

0 commit comments

Comments
 (0)