From b3e4cd04262a56607366e3973ad9b5a2201144ea Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 15 Dec 2009 18:00:16 +0000 Subject: [PATCH] Added a warning comment to SDL_putenv(). "Fixes" Bugzilla #779. --- include/SDL_stdinc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 7a055a57a..82fb0c255 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -267,6 +267,16 @@ char *alloca(); extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); #endif +/** + * \warning On some platforms, the string you pass to SDL_putenv() becomes + * part of the environment table directly...it will use this specific + * buffer, and not a copy of it! This means you can't free it, and + * other pieces of code may try to write to it. In practice, this + * isn't a big deal, but be aware of the possibility. + * However, due to this issue, you should be prepared to + * pass a (char*), or be willing to cast away the constness of your + * string for this call. + */ #ifdef HAVE_PUTENV #define SDL_putenv putenv #else