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");
|
||||
|
||||
struct buf prefix;
|
||||
buf_init(&prefix);
|
||||
for (int i = 0; ctx->dirs[i].path; i++) {
|
||||
struct dir d = ctx->dirs[i];
|
||||
struct buf prefix;
|
||||
buf_init(&prefix);
|
||||
buf_clear(&prefix);
|
||||
|
||||
/*
|
||||
* Replace (rather than augment) $HOME/.config with
|
||||
|
|
@ -100,7 +101,6 @@ find_dir(struct ctx *ctx)
|
|||
char *pfxenv = getenv(d.prefix);
|
||||
buf_add(&prefix, pfxenv ? pfxenv : d.default_prefix);
|
||||
if (!prefix.len) {
|
||||
buf_finish(&prefix);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -130,8 +130,8 @@ find_dir(struct ctx *ctx)
|
|||
wl_list_append(ctx->list, &path->link);
|
||||
}
|
||||
g_strfreev(prefixes);
|
||||
buf_finish(&prefix);
|
||||
}
|
||||
buf_finish(&prefix);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue