strtok ist seit Jahren durch strsep ersetzt. Es ist schneller und

besser.
This commit is contained in:
Yamagi Burmeister 2010-06-17 06:59:33 +00:00
parent d84f0fce34
commit 6669ab3643
3 changed files with 6 additions and 6 deletions

View file

@ -248,7 +248,7 @@ void Key_Console (int key)
{
int i;
strtok( cbd, "\n\r\b" );
strsep( &cbd, "\n\r\b" );
i = (int)strlen( cbd );
if ( i + key_linepos >= MAXCMDLINE - 1)

View file

@ -198,7 +198,7 @@ qboolean Field_Key( menufield_s *f, int key )
if ( ( cbd = Sys_GetClipboardData() ) != 0 )
{
strtok( cbd, "\n\r\b" );
strsep( &cbd, "\n\r\b" );
strncpy( f->buffer, cbd, f->length - 1 );
f->cursor = (int)strlen( f->buffer );

View file

@ -307,9 +307,9 @@ void OGG_LoadPlaylist(char *playlist)
}
/* Count the files in playlist. */
for (ptr = strtok((char *)buffer, "\n");
for (ptr = strsep((char **) &buffer, "\n");
ptr != NULL;
ptr = strtok(NULL, "\n")) {
ptr = strsep(NULL, "\n")) {
if ((byte *)ptr != buffer)
ptr[-1] = '\n';
if (OGG_Check(va("%s/%s", OGG_DIR, ptr)))
@ -320,9 +320,9 @@ void OGG_LoadPlaylist(char *playlist)
ogg_filelist = malloc(sizeof(char *) * ogg_numfiles);
i = 0;
for (ptr = strtok((char *)buffer, "\n");
for (ptr = strsep((char **) &buffer, "\n");
ptr != NULL;
ptr = strtok(NULL, "\n"))
ptr = strsep(NULL, "\n"))
if (OGG_Check(va("%s/%s", OGG_DIR, ptr)))
ogg_filelist[i++] = strdup(va("%s/%s", OGG_DIR, ptr));