buffer that may be overwritten by subsequent calls to the CRT
function, so we must make a safe copy of that buffer for our own
use. This fixes lib/locale.t on Win32 with the Borland compiler,
but presumably could affect other compilers too.
p4raw-id: //depot/perl@31482
setlocale(category, locale = 0)
int category
char * locale
+ PREINIT:
+ char * retval;
CODE:
- RETVAL = setlocale(category, locale);
- if (RETVAL) {
+ retval = setlocale(category, locale);
+ if (retval) {
+ /* Save retval since subsequent setlocale() calls
+ * may overwrite it. */
+ RETVAL = savepv(retval);
#ifdef USE_LOCALE_CTYPE
if (category == LC_CTYPE
#ifdef LC_ALL
}
#endif /* USE_LOCALE_NUMERIC */
}
+ else
+ RETVAL = NULL;
OUTPUT:
RETVAL
-
+ CLEANUP:
+ if (RETVAL)
+ Safefree(RETVAL);
NV
acos(x)