- Remove Q_strrchr(), replace with standard, portable strrchr()
- Add strrchr() to bg_lib.c, patch by DevHC
This commit is contained in:
parent
3ddc59a3ba
commit
b509d770a7
12 changed files with 27 additions and 29 deletions
|
@ -240,6 +240,24 @@ char *strchr( const char *string, int c ) {
|
|||
return (char *) string;
|
||||
}
|
||||
|
||||
char *strrchr(const char *string, int c)
|
||||
{
|
||||
const char *found = 0;
|
||||
|
||||
while(*string)
|
||||
{
|
||||
if(*string == c)
|
||||
found = string;
|
||||
|
||||
string++;
|
||||
}
|
||||
|
||||
if(c)
|
||||
return (char *) found;
|
||||
else
|
||||
return (char *) string;
|
||||
}
|
||||
|
||||
char *strstr( const char *string, const char *strCharSet ) {
|
||||
while ( *string ) {
|
||||
int i;
|
||||
|
|
|
@ -88,6 +88,7 @@ char *strcat( char *strDestination, const char *strSource );
|
|||
char *strcpy( char *strDestination, const char *strSource );
|
||||
int strcmp( const char *string1, const char *string2 );
|
||||
char *strchr( const char *string, int c );
|
||||
char *strrchr(const char *string, int c);
|
||||
char *strstr( const char *string, const char *strCharSet );
|
||||
char *strncpy( char *strDest, const char *strSource, size_t count );
|
||||
int tolower( int c );
|
||||
|
|
|
@ -213,7 +213,7 @@ static void PlayerIntroSound( const char *modelAndSkin ) {
|
|||
char *skin;
|
||||
|
||||
Q_strncpyz( model, modelAndSkin, sizeof(model) );
|
||||
skin = Q_strrchr( model, '/' );
|
||||
skin = strrchr( model, '/' );
|
||||
if ( skin ) {
|
||||
*skin++ = '\0';
|
||||
}
|
||||
|
|
|
@ -626,7 +626,7 @@ Forces a client's skin (for teamplay)
|
|||
static void ForceClientSkin( gclient_t *client, char *model, const char *skin ) {
|
||||
char *p;
|
||||
|
||||
if ((p = Q_strrchr(model, '/')) != 0) {
|
||||
if ((p = strrchr(model, '/')) != 0) {
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue