(stdstring) Turn some functions into static inline functions

This commit is contained in:
twinaphex 2017-04-21 13:35:26 +02:00
parent 120cf21505
commit 06f98fcd16
2 changed files with 21 additions and 32 deletions

View File

@ -29,14 +29,24 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <retro_inline.h>
RETRO_BEGIN_DECLS
bool string_is_empty(const char *data);
static INLINE bool string_is_empty(const char *data)
{
return (data == NULL) || (*data == '\0');
}
bool string_is_equal(const char *a, const char *b);
static INLINE bool string_is_equal(const char *a, const char *b)
{
return (a && b) ? (strcmp(a, b) == 0) : false;
}
bool string_is_equal_noncase(const char *a, const char *b);
static INLINE bool string_is_equal_noncase(const char *a, const char *b)
{
return (a && b) ? (strcasecmp(a, b) == 0) : false;
}
char *string_to_upper(char *s);

View File

@ -25,25 +25,6 @@
#include <string/stdstring.h>
bool string_is_empty(const char *data)
{
return (data == NULL) || (*data == '\0');
}
bool string_is_equal(const char *a, const char *b)
{
if (!a || !b)
return false;
return (strcmp(a, b) == 0);
}
bool string_is_equal_noncase(const char *a, const char *b)
{
if (!a || !b)
return false;
return (strcasecmp(a, b) == 0);
}
char *string_to_upper(char *s)
{
char *cs = (char *)s;
@ -62,17 +43,15 @@ char *string_to_lower(char *s)
char *string_ucwords(char *s)
{
char *cs = (char *)s;
for ( ; *cs != '\0'; cs++)
{
if (*cs == ' ')
{
*(cs+1) = toupper(*(cs+1));
}
}
char *cs = (char *)s;
for ( ; *cs != '\0'; cs++)
{
if (*cs == ' ')
*(cs+1) = toupper(*(cs+1));
}
s[0] = toupper(s[0]);
return s;
s[0] = toupper(s[0]);
return s;
}
char *string_replace_substring(const char *in,