From 1b290edc9cfba6ed94e04257035c37c4df5e5c2d Mon Sep 17 00:00:00 2001 From: special Date: Sun, 14 Sep 2008 03:30:39 +0000 Subject: Patch by dz to remove the one usage of strdup/strtok_r, which is very un-C++ behavior (and silly, since we have sepstream) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10543 e03df62e-2008-0410-955e-edbf42e46eb7 --- win/inspircd_win32wrapper.cpp | 65 ------------------------------------------- win/inspircd_win32wrapper.h | 3 -- 2 files changed, 68 deletions(-) (limited to 'win') diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp index 0b738d538..03d89a7aa 100644 --- a/win/inspircd_win32wrapper.cpp +++ b/win/inspircd_win32wrapper.cpp @@ -91,71 +91,6 @@ int inet_pton(int af, const char *src, void *dst) return rv; } -char * strtok_r(char *_String, const char *_Control, char **_Context) -{ - unsigned char *str; - const unsigned char *ctl = (const unsigned char*)_Control; - unsigned char map[32]; - - if (_Context == 0 || !_Control) - return 0; - - if (!(_String != NULL || *_Context != NULL)) - return 0; - - memset(map, 0, 32); - - do { - map[*ctl >> 3] |= (1 << (*ctl & 7)); - } while (*ctl++); - - /* If string is NULL, set str to the saved - * pointer (i.e., continue breaking tokens out of the string - * from the last strtok call) */ - if (_String != NULL) - { - str = (unsigned char*)_String; - } - else - { - str = (unsigned char*)*_Context; - } - - /* Find beginning of token (skip over leading delimiters). Note that - * there is no token iff this loop sets str to point to the terminal - * null (*str == 0) */ - while ((map[*str >> 3] & (1 << (*str & 7))) && *str != 0) - { - str++; - } - - _String = (char*)str; - - /* Find the end of the token. If it is not the end of the string, - * put a null there. */ - for ( ; *str != 0 ; str++ ) - { - if (map[*str >> 3] & (1 << (*str & 7))) - { - *str++ = 0; - break; - } - } - - /* Update context */ - *_Context = (char*)str; - - /* Determine if a token has been found. */ - if (_String == (char*)str) - { - return NULL; - } - else - { - return _String; - } -} - void setcolor(int color_code) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color_code); diff --git a/win/inspircd_win32wrapper.h b/win/inspircd_win32wrapper.h index 8b7b7d924..4bc364881 100644 --- a/win/inspircd_win32wrapper.h +++ b/win/inspircd_win32wrapper.h @@ -114,9 +114,6 @@ CoreExport const char * inet_ntop(int af, const void * src, char * dst, socklen_ /* Since when does the ISO C++ standard *remove* C functions?! */ #define mkdir(file,mode) _mkdir(file) -/* Recursive token function doesn't exist in VC++ */ -CoreExport char * strtok_r(char *_String, const char *_Control, char **_Context); - /* Unix-style sleep (argument is in seconds) */ __inline void sleep(int seconds) { Sleep(seconds * 1000); } -- cgit v1.2.3