mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
src/common/dir.c: reuse buf within the loop
This commit is contained in:
parent
a5a1757479
commit
4f10cabb8b
1 changed files with 4 additions and 4 deletions
|
|
@ -87,10 +87,11 @@ find_dir(struct ctx *ctx)
|
||||||
{
|
{
|
||||||
char *debug = getenv("LABWC_DEBUG_DIR_CONFIG_AND_THEME");
|
char *debug = getenv("LABWC_DEBUG_DIR_CONFIG_AND_THEME");
|
||||||
|
|
||||||
|
struct buf prefix;
|
||||||
|
buf_init(&prefix);
|
||||||
for (int i = 0; ctx->dirs[i].path; i++) {
|
for (int i = 0; ctx->dirs[i].path; i++) {
|
||||||
struct dir d = ctx->dirs[i];
|
struct dir d = ctx->dirs[i];
|
||||||
struct buf prefix;
|
buf_clear(&prefix);
|
||||||
buf_init(&prefix);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace (rather than augment) $HOME/.config with
|
* Replace (rather than augment) $HOME/.config with
|
||||||
|
|
@ -100,7 +101,6 @@ find_dir(struct ctx *ctx)
|
||||||
char *pfxenv = getenv(d.prefix);
|
char *pfxenv = getenv(d.prefix);
|
||||||
buf_add(&prefix, pfxenv ? pfxenv : d.default_prefix);
|
buf_add(&prefix, pfxenv ? pfxenv : d.default_prefix);
|
||||||
if (!prefix.len) {
|
if (!prefix.len) {
|
||||||
buf_finish(&prefix);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,8 +130,8 @@ find_dir(struct ctx *ctx)
|
||||||
wl_list_append(ctx->list, &path->link);
|
wl_list_append(ctx->list, &path->link);
|
||||||
}
|
}
|
||||||
g_strfreev(prefixes);
|
g_strfreev(prefixes);
|
||||||
buf_finish(&prefix);
|
|
||||||
}
|
}
|
||||||
|
buf_finish(&prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue