mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
string-helpers.c: add string_empty()
This commit is contained in:
parent
8c9be2f0d1
commit
c066821046
9 changed files with 27 additions and 14 deletions
|
|
@ -14,16 +14,10 @@
|
|||
#include "config/session.h"
|
||||
#include "labwc.h"
|
||||
|
||||
static bool
|
||||
string_empty(const char *s)
|
||||
{
|
||||
return !s || !*s;
|
||||
}
|
||||
|
||||
static void
|
||||
process_line(char *line)
|
||||
{
|
||||
if (string_empty(line) || line[0] == '#') {
|
||||
if (string_null_or_empty(line) || line[0] == '#') {
|
||||
return;
|
||||
}
|
||||
char *key = NULL;
|
||||
|
|
@ -39,7 +33,7 @@ process_line(char *line)
|
|||
buf_add(&value, string_strip(++p));
|
||||
buf_expand_shell_variables(&value);
|
||||
buf_expand_tilde(&value);
|
||||
if (string_empty(key) || !value.len) {
|
||||
if (string_null_or_empty(key) || !value.len) {
|
||||
goto error;
|
||||
}
|
||||
setenv(key, value.buf, 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue