tried to clean strdup() mess: we now have wxStrdup[AW] which should be always available

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18172 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-12-10 00:43:28 +00:00
parent 2a5d3f5738
commit 07243717e2
3 changed files with 45 additions and 37 deletions

View File

@@ -964,15 +964,26 @@ WXDLLEXPORT int wxTolower(wxChar ch) { return (wxChar)CharLower((LPTSTR)(ch)); }
WXDLLEXPORT int wxToupper(wxChar ch) { return (wxChar)CharUpper((LPTSTR)(ch)); }
#endif
#ifndef wxStrdup
WXDLLEXPORT wxChar * wxStrdup(const wxChar *psz)
#ifndef wxStrdupA
WXDLLEXPORT char *wxStrdupA(const char *s)
{
size_t size = (wxStrlen(psz) + 1) * sizeof(wxChar);
wxChar *ret = (wxChar *) malloc(size);
memcpy(ret, psz, size);
return strcpy((char *)malloc(strlen(s) + 1), s);
}
#endif // wxStrdupA
#ifndef wxStrdupW
WXDLLEXPORT wchar_t * wxStrdupW(const wchar_t *pwz)
{
size_t size = (wxWcslen(pwz) + 1) * sizeof(wchar_t);
wchar_t *ret = (wchar_t *) malloc(size);
memcpy(ret, pwz, size);
return ret;
}
#endif
#endif // wxStrdupW
#ifndef wxStricmp
int WXDLLEXPORT wxStricmp(const wxChar *psz1, const wxChar *psz2)