1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 14:53:26 +01:00

simplify string_is_empty

This commit is contained in:
Jfreegman 2013-10-18 23:58:33 -04:00
parent 0396ce6456
commit 7a0951afc6

View File

@ -50,14 +50,10 @@ void print_time(WINDOW *window)
wattroff(window, COLOR_PAIR(CYAN));
}
/* check that the string has one non-space character */
/* Returns 1 if the string is empty, 0 otherwise */
int string_is_empty(char *string)
{
int rc = 0;
char *copy = strdup(string);
rc = ((strtok(copy, " ") == NULL) ? 1 : 0);
free(copy);
return rc;
return strlen(string) <= 0;
}
/* convert wide characters to null terminated string */