use != '\0' comparison instead of SDL_strlen in the functions of SDL_getenv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/src/stdlib/SDL_getenv.c b/src/stdlib/SDL_getenv.c
index d54cfe9..add8332 100644
--- a/src/stdlib/SDL_getenv.c
+++ b/src/stdlib/SDL_getenv.c
@@ -48,7 +48,7 @@ int
SDL_setenv(const char *name, const char *value, int overwrite)
{
/* Input validation */
- if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
+ if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) {
return (-1);
}
@@ -59,7 +59,7 @@ int
SDL_setenv(const char *name, const char *value, int overwrite)
{
/* Input validation */
- if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
+ if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) {
return (-1);
}
@@ -82,7 +82,7 @@ SDL_setenv(const char *name, const char *value, int overwrite)
char *new_variable;
/* Input validation */
- if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
+ if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) {
return (-1);
}
@@ -115,7 +115,7 @@ SDL_setenv(const char *name, const char *value, int overwrite)
char *new_variable;
/* Input validation */
- if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
+ if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) {
return (-1);
}
@@ -181,7 +181,7 @@ SDL_getenv(const char *name)
#endif
/* Input validation */
- if (!name || !*name) {
+ if (!name || *name == '\0') {
return NULL;
}
@@ -194,7 +194,7 @@ SDL_getenv(const char *name)
size_t bufferlen;
/* Input validation */
- if (!name || SDL_strlen(name)==0) {
+ if (!name || *name == '\0') {
return NULL;
}
@@ -222,7 +222,7 @@ SDL_getenv(const char *name)
char *value;
/* Input validation */
- if (!name || SDL_strlen(name)==0) {
+ if (!name || *name == '\0') {
return NULL;
}