#include <stdbool.h>
#include <locale.h>
+static bool is_null_or_empty(const char *s)
+{
+ return !s || !*s;
+}
+
static const char *append_usage_str = "";
void argconfig_append_usage(const char *str)
if (s->argument_type == optional_argument)
short_opts[short_index++] = ':';
}
- if (s->option && strlen(s->option)) {
+ if (!is_null_or_empty(s->option)) {
long_opts[option_index].name = s->option;
long_opts[option_index].has_arg = s->argument_type;
}
char *tmp;
char *p;
- if (!string || !strlen(string))
+ if (is_null_or_empty(string))
return 0;
tmp = strtok(string, ",");
char *tmp;
char *p;
- if (!string || !strlen(string))
+ if (is_null_or_empty(string))
return 0;
tmp = strtok(string, ",");
char *tmp;
char *p;
- if (!string || !strlen(string))
+ if (is_null_or_empty(string))
return 0;
tmp = strtok(string, ",");
char *tmp; \
char *p; \
\
- if (!string || !strlen(string)) \
+ if (is_null_or_empty(string)) \
return 0; \
\
tmp = strtok(string, ","); \