commit: f6f1b6144fba3b7b53210c23978a9d87313f3719
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 10 13:20:12 2026 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Jan 10 13:20:12 2026 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f6f1b614
libq/xarray: drop DECLARE_ARRAY macro
The macro does two definitions and basically hides too much. On top of
that, array needs a healhtier interface so mistakes are less likely to
be made.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
libq/tree.c | 14 +++++++++++---
libq/xarray.c | 5 ++---
libq/xarray.h | 2 --
main.c | 32 +++++++++++++++++++++++++++-----
main.h | 5 ++++-
q.c | 19 +++++++++++++++----
qcheck.c | 31 +++++++++++++++++--------------
qdepends.c | 29 +++++++++++++++++------------
qkeyword.c | 7 +++++--
qlist.c | 5 ++++-
qlop.c | 48 ++++++++++++++++++++++++++++++++++++++----------
qpkg.c | 5 ++++-
qsize.c | 17 ++++++++++-------
qwhich.c | 10 +++++++---
14 files changed, 161 insertions(+), 68 deletions(-)
diff --git a/libq/tree.c b/libq/tree.c
index 507549f..561ad6a 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -246,10 +246,13 @@ void
tree_close(tree_ctx *ctx)
{
if (ctx->cache.categories != NULL) {
- DECLARE_ARRAY(t);
+ array_t t_s;
+ array_t *t = &t_s;
size_t n;
tree_cat_ctx *cat;
+ VAL_CLEAR(t_s);
+
values_set(ctx->cache.categories, t);
free_set(ctx->cache.categories);
ctx->cache.categories = NULL; /* must happen before close_cat
*/
@@ -273,7 +276,7 @@ tree_close(tree_ctx *ctx)
else if (ctx->tree_fd >= 0)
close(ctx->tree_fd); /* closedir() above does this for us */
close(ctx->portroot_fd);
- if (ctx->do_sort)
+ if (ctx->cat_de != NULL)
scandir_free(ctx->cat_de, ctx->cat_cnt);
if (ctx->repo != NULL)
free(ctx->repo);
@@ -388,6 +391,8 @@ tree_next_cat(tree_ctx *ctx)
struct dirent **ret;
/* exploit the cache instead of reading from
directory */
+ if (ctx->cat_de != NULL)
+ scandir_free(ctx->cat_de, ctx->cat_cnt);
ctx->cat_cnt = cnt_set(ctx->cache.categories);
ctx->cat_de = ret = xmalloc(sizeof(*ret) *
ctx->cat_cnt);
list_set(ctx->cache.categories, &cats);
@@ -2296,9 +2301,12 @@ tree_foreach_pkg_int
ctx->do_sort = false;
if (postsort) {
- DECLARE_ARRAY(cats);
+ array_t cats_s;
+ array_t *cats = &cats_s;
size_t n;
+ VAL_CLEAR(cats_s);
+
/* should never happen, but perhaps a tree implementation
* populated something, then don't leak it */
if (ctx->cache.categories != NULL)
diff --git a/libq/xarray.c b/libq/xarray.c
index 3251a12..fefc80b 100644
--- a/libq/xarray.c
+++ b/libq/xarray.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2024 Gentoo Foundation
+ * Copyright 2003-2026 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
*
* Copyright 2003-2007 Ned Ludd - <[email protected]>
@@ -70,9 +70,8 @@ void xarraydelete(array_t *arr, size_t elem)
*/
void xarrayfree_int(array_t *arr)
{
- array_t blank = array_init_decl;
free(arr->eles);
- *arr = blank;
+ VALP_CLEAR(arr);
}
void xarrayfree(array_t *arr)
diff --git a/libq/xarray.h b/libq/xarray.h
index 6f5b128..afd8332 100644
--- a/libq/xarray.h
+++ b/libq/xarray.h
@@ -30,9 +30,7 @@ typedef struct {
#define array_for_each_rev(arr, n, ele) \
for (n = array_cnt(arr); n-- > 0 && (ele = (arr)->eles[n]); /*nothing*/)
#define array_get_elem(arr, n) (arr->eles[n])
-#define array_init_decl { .eles = NULL, .num = 0, }
#define array_cnt(arr) (arr)->num
-#define DECLARE_ARRAY(arr) array_t _##arr = array_init_decl, *arr = &_##arr
#define xarraypush_str(arr, ele) xarraypush(arr, ele, strlen(ele) + 1 /*NUL*/)
#define xarraypush_struct(arr, ele) xarraypush(arr, ele, sizeof(*(ele)))
diff --git a/main.c b/main.c
index bbc1065..fcb3fe1 100644
--- a/main.c
+++ b/main.c
@@ -46,9 +46,9 @@ set *features;
set *ev_use;
char *install_mask;
char *binpkg_format;
-DECLARE_ARRAY(overlays);
-DECLARE_ARRAY(overlay_names);
-DECLARE_ARRAY(overlay_src);
+array_t *overlays;
+array_t *overlay_names;
+array_t *overlay_src;
static char *portedb;
static char *eprefix;
@@ -1221,10 +1221,13 @@ initialize_portage_env(void)
fprintf(stderr, "%s = %s\n", var->name,
*var->value.s);
break;
case _Q_ISET: {
- DECLARE_ARRAY(vals);
+ array_t vals_s;
+ array_t *vals = &vals_s;
size_t n;
char *val;
+ VAL_CLEAR(vals_s);
+
fprintf(stderr, "%s = ", var->name);
array_set(*var->value.t, vals);
array_for_each(vals, n, val) {
@@ -1251,6 +1254,9 @@ int main(int argc, char **argv)
struct stat st;
struct winsize winsz;
int i;
+ array_t overlays_s;
+ array_t overlay_names_s;
+ array_t overlay_src_s;
warnout = stderr;
IF_DEBUG(init_coredumps());
@@ -1259,6 +1265,13 @@ int main(int argc, char **argv)
/* ensure any err/warn doesn't use unitialised vars */
color_clear();
+ VAL_CLEAR(overlays_s);
+ VAL_CLEAR(overlay_names_s);
+ VAL_CLEAR(overlay_src_s);
+ overlays = &overlays_s;
+ overlay_names = &overlay_names_s;
+ overlay_src = &overlay_src_s;
+
/* initialise all the properties with their default value */
for (i = 0; vars_to_read[i].name; ++i) {
env_vars *var = &vars_to_read[i];
@@ -1334,5 +1347,14 @@ int main(int argc, char **argv)
initialize_portage_env();
optind = 0;
- return q_main(argc, argv);
+ i = q_main(argc, argv);
+
+ xarrayfree(overlays);
+ xarrayfree(overlay_names);
+ xarrayfree(overlay_src);
+
+ if (warnout != stderr)
+ fclose(warnout);
+
+ return i;
}
diff --git a/main.h b/main.h
index c3139b0..ca6fa3c 100644
--- a/main.h
+++ b/main.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2024 Gentoo Foundation
+ * Copyright 2005-2026 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
*
* Copyright 2005-2010 Ned Ludd - <[email protected]>
@@ -44,6 +44,9 @@ extern const char *argv0;
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr)))
+#define VALP_CLEAR(p) memset(p, 0, sizeof(*(p)))
+#define VAL_CLEAR(v) VALP_CLEAR(&(v))
+
#ifndef BUFSIZE
# define BUFSIZE 8192
#endif
diff --git a/q.c b/q.c
index 14e7adc..f31a428 100644
--- a/q.c
+++ b/q.c
@@ -632,10 +632,13 @@ int q_main(int argc, char **argv)
printf("%s\"%s\"%s", RED,
*var->value.s, NORM);
break;
case _Q_ISET: {
- DECLARE_ARRAY(vals);
+ array_t vals_s;
+ array_t *vals = &vals_s;
size_t n;
char *val;
+ VAL_CLEAR(vals_s);
+
printf("%s\"", RED);
array_set(*var->value.t, vals);
array_for_each(vals, n, val) {
@@ -669,10 +672,13 @@ int q_main(int argc, char **argv)
printf("%s%s%s", RED,
*var->value.s, NORM);
break;
case _Q_ISET: {
- DECLARE_ARRAY(vals);
+ array_t vals_s;
+ array_t *vals = &vals_s;
size_t n;
char *val;
+ VAL_CLEAR(vals_s);
+
array_set(*var->value.t, vals);
array_for_each(vals, n, val) {
printf("%s%s", n == 0 ?
RED : " ", val);
@@ -692,8 +698,10 @@ int q_main(int argc, char **argv)
}
if (print_masks) {
- DECLARE_ARRAY(masks);
- DECLARE_ARRAY(files);
+ array_t masks_s;
+ array_t files_s;
+ array_t *masks = &masks_s;
+ array_t *files = &files_s;
char *mask;
size_t n;
int j;
@@ -706,6 +714,9 @@ int q_main(int argc, char **argv)
depend_atom *atom;
depend_atom *qatom;
+ VAL_CLEAR(masks_s);
+ VAL_CLEAR(files_s);
+
array_set(package_masks, masks);
values_set(package_masks, files);
diff --git a/qcheck.c b/qcheck.c
index b6d5671..528e46a 100644
--- a/qcheck.c
+++ b/qcheck.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2024 Gentoo Foundation
+ * Copyright 2005-2026 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
*
* Copyright 2005-2010 Ned Ludd - <[email protected]>
@@ -429,12 +429,12 @@ int qcheck_main(int argc, char **argv)
size_t i;
int ret;
tree_ctx *vdb;
- DECLARE_ARRAY(regex_arr);
depend_atom *atom;
- DECLARE_ARRAY(atoms);
+ array_t regex_arr;
+ array_t atoms;
struct qcheck_opt_state state = {
- .atoms = atoms,
- .regex_arr = regex_arr,
+ .atoms = &atoms,
+ .regex_arr = ®ex_arr,
.bad_only = false,
.qc_update = false,
.chk_afk = true,
@@ -445,13 +445,16 @@ int qcheck_main(int argc, char **argv)
.fmt = NULL,
};
+ VAL_CLEAR(regex_arr);
+ VAL_CLEAR(atoms);
+
while ((ret = GETOPT_LONG(QCHECK, qcheck, "")) != -1) {
switch (ret) {
COMMON_GETOPTS_CASES(qcheck)
case 's': {
regex_t preg;
xregcomp(&preg, optarg, REG_EXTENDED | REG_NOSUB);
- xarraypush(regex_arr, &preg, sizeof(preg));
+ xarraypush(state.regex_arr, &preg, sizeof(preg));
break;
}
case 'u': state.qc_update = true; break;
@@ -475,15 +478,15 @@ int qcheck_main(int argc, char **argv)
if (!atom)
warn("invalid atom: %s", argv[i]);
else
- xarraypush_ptr(atoms, atom);
+ xarraypush_ptr(state.atoms, atom);
}
vdb = tree_open_vdb(portroot, portvdb);
ret = -1;
if (vdb != NULL) {
- if (array_cnt(atoms) != 0) {
+ if (array_cnt(state.atoms) != 0) {
ret = 0;
- array_for_each(atoms, i, atom) {
+ array_for_each(state.atoms, i, atom) {
ret |= tree_foreach_pkg_sorted(vdb, qcheck_cb,
&state, atom);
}
} else {
@@ -491,14 +494,14 @@ int qcheck_main(int argc, char **argv)
}
tree_close(vdb);
}
- if (array_cnt(regex_arr) > 0) {
+ if (array_cnt(state.regex_arr) > 0) {
void *preg;
- array_for_each(regex_arr, i, preg)
+ array_for_each(state.regex_arr, i, preg)
regfree(preg);
}
- xarrayfree(regex_arr);
- array_for_each(atoms, i, atom)
+ xarrayfree(state.regex_arr);
+ array_for_each(state.atoms, i, atom)
atom_implode(atom);
- xarrayfree_int(atoms);
+ xarrayfree_int(state.atoms);
return ret != 0;
}
diff --git a/qdepends.c b/qdepends.c
index e4be97f..3429288 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2023 Gentoo Authors
+ * Copyright 2005-2026 Gentoo Authors
* Distributed under the terms of the GNU General Public License v2
*
* Copyright 2005-2010 Ned Ludd - <[email protected]>
@@ -320,11 +320,11 @@ qdepends_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
int qdepends_main(int argc, char **argv)
{
depend_atom *atom;
- DECLARE_ARRAY(atoms);
- DECLARE_ARRAY(deps);
+ array_t atoms;
+ array_t deps;
struct qdepends_opt_state state = {
- .atoms = atoms,
- .deps = deps,
+ .atoms = &atoms,
+ .deps = &deps,
.udeps = create_set(),
.qmode = 0,
.format = "%[CATEGORY]%[PF]",
@@ -336,6 +336,9 @@ int qdepends_main(int argc, char **argv)
int ret;
bool do_pretty = false;
+ VAL_CLEAR(atoms);
+ VAL_CLEAR(deps);
+
if (quiet)
state.format = "%[CATEGORY]%[PN]";
@@ -404,7 +407,7 @@ int qdepends_main(int argc, char **argv)
if (!atom)
warn("invalid atom: %s", argv[i]);
else
- xarraypush_ptr(atoms, atom);
+ xarraypush_ptr(state.atoms, atom);
}
if (state.qmode & QMODE_INSTALLED || verbose)
@@ -421,8 +424,10 @@ int qdepends_main(int argc, char **argv)
state.rtree = NULL;
if (state.resolve)
state.rtree = tree_open(portroot,
overlay);
- if (!(state.qmode & QMODE_REVERSE) &&
array_cnt(atoms) > 0) {
- array_for_each(atoms, i, atom) {
+ if (!(state.qmode & QMODE_REVERSE) &&
+ array_cnt(state.atoms) > 0)
+ {
+ array_for_each(state.atoms, i, atom) {
ret |=
tree_foreach_pkg_sorted(t,
qdepends_results_cb, &state, atom);
}
@@ -438,8 +443,8 @@ int qdepends_main(int argc, char **argv)
} else { /* INSTALLED */
if (state.resolve)
state.rtree = tree_open_vdb(portroot, portvdb);
- if (!(state.qmode & QMODE_REVERSE) && array_cnt(atoms) > 0) {
- array_for_each(atoms, i, atom) {
+ if (!(state.qmode & QMODE_REVERSE) && array_cnt(state.atoms) >
0) {
+ array_for_each(state.atoms, i, atom) {
ret |= tree_foreach_pkg_fast(state.vdb,
qdepends_results_cb, &state,
atom);
}
@@ -456,9 +461,9 @@ int qdepends_main(int argc, char **argv)
if (state.depend != NULL)
free(state.depend);
- array_for_each(atoms, i, atom)
+ array_for_each(state.atoms, i, atom)
atom_implode(atom);
- xarrayfree_int(atoms);
+ xarrayfree_int(state.atoms);
xarrayfree_int(state.deps);
free_set(state.udeps);
diff --git a/qkeyword.c b/qkeyword.c
index 4899d47..fb14ce3 100644
--- a/qkeyword.c
+++ b/qkeyword.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2023 Gentoo Foundation
+ * Copyright 2005-2026 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
*
* Copyright 2006 Thomas A. Cort - <[email protected]>
@@ -898,13 +898,16 @@ int qkeyword_main(int argc, char **argv)
/* prepare masks for easy(er) matching by key-ing on CAT/PN */
{
- DECLARE_ARRAY(masks);
+ array_t masks_s;
+ array_t *masks;
array_t *bucket;
array_t *ebuck;
size_t n;
char *mask;
depend_atom *atom;
+ VAL_CLEAR(masks_s);
+ masks = &masks_s;
pmasks = create_set();
array_set(package_masks, masks);
diff --git a/qlist.c b/qlist.c
index 41fe933..19c8d44 100644
--- a/qlist.c
+++ b/qlist.c
@@ -251,12 +251,15 @@ qlist_match(
}
if (applymasks) {
- DECLARE_ARRAY(masks);
+ array_t masks_s;
+ array_t *masks = &masks_s;
depend_atom *matom;
char *mask;
size_t n;
bool match = false;
+ VAL_CLEAR(masks_s);
+
array_set(package_masks, masks);
array_for_each(masks, n, mask) {
diff --git a/qlop.c b/qlop.c
index 3c584c3..737d859 100644
--- a/qlop.c
+++ b/qlop.c
@@ -103,7 +103,7 @@ parse_date(const char *sdate, time_t *t)
struct tm tm;
const char *s;
- memset(&tm, 0, sizeof(tm));
+ VAL_CLEAR(tm);
s = strchr(sdate, '|');
if (s) {
@@ -434,9 +434,11 @@ static int do_emerge_log(
depend_atom *atom;
depend_atom *atomw;
depend_atom *upgrade_atom = NULL;
- DECLARE_ARRAY(merge_matches);
+ array_t merge_matches_s;
+ array_t unmerge_matches_s;
+ array_t *merge_matches = &merge_matches_s;
+ array_t *unmerge_matches = &unmerge_matches_s;
set *merge_averages = create_set();
- DECLARE_ARRAY(unmerge_matches);
set *unmerge_averages = create_set();
set *atomset = NULL;
size_t i;
@@ -448,6 +450,9 @@ static int do_emerge_log(
struct pkg_match *pkgw;
#define strpfx(X, Y) strncmp(X, Y, sizeof(Y) - 1)
+ VAL_CLEAR(merge_matches_s);
+ VAL_CLEAR(unmerge_matches_s);
+
/* support relative path in here and now, when using ROOT, stick to
* it, turning relative into a moot point */
if (portroot[1] == '\0')
@@ -517,7 +522,10 @@ static int do_emerge_log(
* "valid" one, such that dummy emerge calls
(e.g.
* emerge -pv foo) are ignored */
if (last_merge != tstart_emerge) {
- DECLARE_ARRAY(vals);
+ array_t vals_s;
+ array_t *vals = &vals_s;
+
+ VAL_CLEAR(vals_s);
values_set(atomset, vals);
array_for_each(vals, i, atomw)
@@ -1176,7 +1184,10 @@ static int do_emerge_log(
size_t total_merges = 0;
size_t total_unmerges = 0;
time_t total_time = (time_t)0;
- DECLARE_ARRAY(avgs);
+ array_t avgs_s;
+ array_t *avgs = &avgs_s;
+
+ VAL_CLEAR(avgs_s);
values_set(merge_averages, avgs);
xarraysort(avgs, pkg_sort_cb);
@@ -1227,12 +1238,15 @@ static int do_emerge_log(
printf("\n");
}
} else if (flags->do_predict) {
- DECLARE_ARRAY(avgs);
+ array_t avgs_s;
+ array_t *avgs = &avgs_s;
enum { P_INIT = 0, P_SREV, P_SRCH } pkgstate;
size_t j;
time_t ptime;
char found;
+ VAL_CLEAR(avgs_s);
+
values_set(merge_averages, avgs);
xarraysort(avgs, pkg_sort_cb);
xarraysort(atoms, atom_compar_cb);
@@ -1340,7 +1354,11 @@ static int do_emerge_log(
}
{
- DECLARE_ARRAY(t);
+ array_t t_s;
+ array_t *t = &t_s;
+
+ VAL_CLEAR(t_s);
+
values_set(merge_averages, t);
array_for_each(t, i, pkgw) {
atom_implode(pkgw->atom);
@@ -1367,7 +1385,11 @@ static int do_emerge_log(
}
xarrayfree(unmerge_matches);
if (atomset != NULL) {
- DECLARE_ARRAY(t);
+ array_t t_s;
+ array_t *t = &t_s;
+
+ VAL_CLEAR(t_s);
+
values_set(atomset, t);
array_for_each(t, i, atom)
atom_implode(atom);
@@ -1395,11 +1417,14 @@ static array_t *probe_proc(array_t *atoms)
ssize_t rpathlen;
char *p;
depend_atom *atom;
- DECLARE_ARRAY(ret_atoms);
+ array_t ret_atoms_s;
+ array_t *ret_atoms = &ret_atoms_s;
size_t i;
char *cmdline = NULL;
size_t cmdlinesize = 0;
+ VAL_CLEAR(ret_atoms_s);
+
/* /proc/<pid>/path/<[0-9]+link>
* /proc/<pid>/fd/<[0-9]+link> */
if ((procslen = scandir("/proc", &procs, NULL, NULL)) > 0) {
@@ -1582,9 +1607,12 @@ int qlop_main(int argc, char **argv)
char *p;
char *q;
depend_atom *atom;
- DECLARE_ARRAY(atoms);
+ array_t atoms_s;
+ array_t *atoms = &atoms_s;
int runningmode = 0;
+ VAL_CLEAR(atoms_s);
+
start_time = -1;
end_time = -1;
m.do_time = 0;
diff --git a/qpkg.c b/qpkg.c
index 4f78a85..0eb3c68 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -78,7 +78,8 @@ qpkg_clean(qpkg_cb_args *args)
uint64_t num_all_bytes = 0;
set *known_pkgs = NULL;
set *bin_pkgs = NULL;
- DECLARE_ARRAY(bins);
+ array_t bins_s;
+ array_t *bins = &bins_s;
tree_ctx *t;
tree_ctx *pkgs;
char *binatomstr;
@@ -89,6 +90,8 @@ qpkg_clean(qpkg_cb_args *args)
if (pkgs == NULL)
return 1;
+ VAL_CLEAR(bins_s);
+
bin_pkgs = tree_get_atoms(pkgs, true, bin_pkgs);
if (bin_pkgs == NULL)
return 1;
diff --git a/qsize.c b/qsize.c
index 391d357..c0c45c0 100644
--- a/qsize.c
+++ b/qsize.c
@@ -189,18 +189,18 @@ int qsize_main(int argc, char **argv)
size_t i;
int ret;
tree_ctx *vdb;
- DECLARE_ARRAY(ignore_regexp);
+ array_t ignore_regexp;
+ array_t atoms;
depend_atom *atom;
- DECLARE_ARRAY(atoms);
struct qsize_opt_state state = {
- .atoms = atoms,
+ .atoms = &atoms,
.search_all = 0,
.fs_size = 0,
.summary = 0,
.summary_only = 0,
.disp_units = 0,
.str_disp_units = NULL,
- .ignore_regexp = ignore_regexp,
+ .ignore_regexp = &ignore_regexp,
.uniq_files = create_set(),
.num_all_files = 0,
.num_all_nonfiles = 0,
@@ -210,6 +210,9 @@ int qsize_main(int argc, char **argv)
.fmt = NULL,
};
+ VAL_CLEAR(ignore_regexp);
+ VAL_CLEAR(atoms);
+
while ((ret = GETOPT_LONG(QSIZE, qsize, "")) != -1) {
switch (ret) {
COMMON_GETOPTS_CASES(qsize)
@@ -252,10 +255,10 @@ int qsize_main(int argc, char **argv)
vdb = tree_open_vdb(portroot, portvdb);
if (vdb != NULL) {
- if (array_cnt(atoms) > 0) {
- array_for_each(atoms, i, atom) {
+ if (array_cnt(state.atoms) > 0) {
+ array_for_each(state.atoms, i, atom) {
if (atom->CATEGORY == NULL &&
- i + 1 < array_cnt(atoms))
+ i + 1 < array_cnt(state.atoms))
{
ret = tree_foreach_pkg_cached(vdb,
qsize_cb, &state, atom);
} else {
diff --git a/qwhich.c b/qwhich.c
index 7db4158..610eb30 100644
--- a/qwhich.c
+++ b/qwhich.c
@@ -71,8 +71,10 @@ struct qwhich_mode {
int qwhich_main(int argc, char **argv)
{
depend_atom *atom;
- DECLARE_ARRAY(atoms);
- DECLARE_ARRAY(trees);
+ array_t atoms_s;
+ array_t trees_s;
+ array_t *atoms = &atoms_s;
+ array_t *trees = &trees_s;
struct qwhich_mode m;
struct tree_match_ctx *tmc;
struct tree_match_ctx *tmcw;
@@ -87,7 +89,9 @@ int qwhich_main(int argc, char **argv)
int repolen;
const char *ext;
- memset(&m, 0, sizeof(m));
+ VAL_CLEAR(m);
+ VAL_CLEAR(atoms_s);
+ VAL_CLEAR(trees_s);
while ((ret = GETOPT_LONG(QWHICH, qwhich, "")) != -1) {
switch (ret) {