mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 06:03:04 +01:00
simplify string_is_empty
This commit is contained in:
parent
0396ce6456
commit
7a0951afc6
@ -50,14 +50,10 @@ void print_time(WINDOW *window)
|
|||||||
wattroff(window, COLOR_PAIR(CYAN));
|
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 string_is_empty(char *string)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
return strlen(string) <= 0;
|
||||||
char *copy = strdup(string);
|
|
||||||
rc = ((strtok(copy, " ") == NULL) ? 1 : 0);
|
|
||||||
free(copy);
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert wide characters to null terminated string */
|
/* convert wide characters to null terminated string */
|
||||||
|
Loading…
Reference in New Issue
Block a user