Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: /, tests/, libq/
Date: Thu, 29 Dec 2016 02:26:13
Message-Id: 1482966757.572b19d78b29f82554fc31fe814de29742f0874c.vapier@gentoo
1 commit: 572b19d78b29f82554fc31fe814de29742f0874c
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 28 23:12:37 2016 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 28 23:12:37 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=572b19d7
7
8 drop _q_static and standardize func prototypes a bit
9
10 libq/atom_compare.c | 12 +++--
11 libq/atom_explode.c | 14 +++---
12 libq/colors.c | 4 +-
13 libq/human_readable.c | 4 +-
14 libq/profile.c | 4 +-
15 libq/safe_io.c | 4 +-
16 libq/scandirat.c | 6 ++-
17 libq/vdb.c | 43 +++++++++++------
18 libq/vdb_get_next_dir.c | 3 +-
19 libq/virtuals.c | 16 ++++---
20 libq/xchdir.c | 4 +-
21 libq/xmkdir.c | 18 +++++---
22 main.c | 120 ++++++++++++++++++++++++++++--------------------
23 main.h | 4 --
24 qatom.c | 4 +-
25 qcache.c | 78 +++++++++++++++----------------
26 qcheck.c | 6 ++-
27 qdepends.c | 52 +++++++++++----------
28 qfile.c | 6 +--
29 qglsa.c | 18 ++++----
30 qgrep.c | 35 +++++++-------
31 qlist.c | 11 +++--
32 qlop.c | 19 ++++----
33 qmerge.c | 79 ++++++++++++++++---------------
34 qpkg.c | 26 +++++------
35 qsize.c | 3 +-
36 qtbz2.c | 12 ++---
37 tests/tests.h | 1 -
38 28 files changed, 334 insertions(+), 272 deletions(-)
39
40 diff --git a/libq/atom_compare.c b/libq/atom_compare.c
41 index dbea5b3..b69b809 100644
42 --- a/libq/atom_compare.c
43 +++ b/libq/atom_compare.c
44 @@ -6,10 +6,11 @@
45 * Copyright 2005-2014 Mike Frysinger - <vapier@g.o>
46 */
47
48 -const char * const booga[] = {"!!!", "!=", "==", ">", "<"};
49 +static const char * const booga[] = {"!!!", "!=", "==", ">", "<"};
50 enum { ERROR=0, NOT_EQUAL, EQUAL, NEWER, OLDER };
51
52 -static int _atom_compare_match(int ret, atom_operator op)
53 +static int
54 +_atom_compare_match(int ret, atom_operator op)
55 {
56 if (op == ATOM_OP_NONE)
57 return ret;
58 @@ -39,7 +40,8 @@ static int _atom_compare_match(int ret, atom_operator op)
59 * foo-1 <OLDER> foo-2
60 * foo-1 <NOT_EQUAL> bar-1
61 */
62 -static int atom_compare(const depend_atom *a1, const depend_atom *a2)
63 +static int
64 +atom_compare(const depend_atom *a1, const depend_atom *a2)
65 {
66 /* sanity check that at most one has operators */
67 if (a1->pfx_op != ATOM_OP_NONE || a1->sfx_op != ATOM_OP_NONE) {
68 @@ -189,8 +191,8 @@ static int atom_compare(const depend_atom *a1, const depend_atom *a2)
69 return _atom_compare_match(NEWER, pfx_op);
70 }
71
72 -int atom_compare_str(const char * const s1, const char * const s2);
73 -int atom_compare_str(const char * const s1, const char * const s2)
74 +static int
75 +atom_compare_str(const char * const s1, const char * const s2)
76 {
77 depend_atom *a1, *a2;
78 int ret = ERROR;
79
80 diff --git a/libq/atom_explode.c b/libq/atom_explode.c
81 index 2855246..956ac49 100644
82 --- a/libq/atom_explode.c
83 +++ b/libq/atom_explode.c
84 @@ -40,8 +40,9 @@ typedef struct {
85 char *P, *SLOT, *REPO;
86 } depend_atom;
87
88 -void atom_print(const depend_atom *atom);
89 -void atom_print(const depend_atom *atom)
90 +#ifdef EBUG
91 +static void
92 +atom_print(const depend_atom *atom)
93 {
94 if (atom->CATEGORY)
95 printf("%s/", atom->CATEGORY);
96 @@ -53,14 +54,15 @@ void atom_print(const depend_atom *atom)
97 if (atom->REPO)
98 printf("::%s", atom->REPO);
99 }
100 +#endif
101
102 #ifdef _USE_CACHE
103 static depend_atom *_atom_cache = NULL;
104 static size_t _atom_cache_len = 0;
105 #endif
106
107 -depend_atom *atom_explode(const char *atom);
108 -depend_atom *atom_explode(const char *atom)
109 +static depend_atom *
110 +atom_explode(const char *atom)
111 {
112 depend_atom *ret;
113 char *ptr;
114 @@ -245,8 +247,8 @@ depend_atom *atom_explode(const char *atom)
115 return ret;
116 }
117
118 -void atom_implode(depend_atom *atom);
119 -void atom_implode(depend_atom *atom)
120 +static void
121 +atom_implode(depend_atom *atom)
122 {
123 if (!atom)
124 errf("Atom is empty !");
125
126 diff --git a/libq/colors.c b/libq/colors.c
127 index 6ddcdda..f90be0d 100644
128 --- a/libq/colors.c
129 +++ b/libq/colors.c
130 @@ -45,8 +45,8 @@ static cpairtype color_pairs[] = {
131 {"eol", COLOR("00", "00") },
132 };
133
134 -void color_remap(void);
135 -void color_remap(void)
136 +static void
137 +color_remap(void)
138 {
139 FILE *fp;
140 unsigned int i;
141
142 diff --git a/libq/human_readable.c b/libq/human_readable.c
143 index 0bb044a..931a994 100644
144 --- a/libq/human_readable.c
145 +++ b/libq/human_readable.c
146 @@ -24,14 +24,14 @@
147
148 #include <stdio.h>
149
150 -const char *make_human_readable_str(unsigned long long,unsigned long,unsigned long);
151 enum {
152 KILOBYTE = 1024,
153 MEGABYTE = (KILOBYTE*1024),
154 GIGABYTE = (MEGABYTE*1024)
155 };
156
157 -const char* make_human_readable_str(unsigned long long val,
158 +static const char *
159 +make_human_readable_str(unsigned long long val,
160 unsigned long block_size, unsigned long display_unit)
161 {
162 static const char unit_chars[] = {
163
164 diff --git a/libq/profile.c b/libq/profile.c
165 index 66e5caf..c954ba6 100644
166 --- a/libq/profile.c
167 +++ b/libq/profile.c
168 @@ -1,6 +1,6 @@
169 typedef void *(q_profile_callback_t)(void *, char *);
170
171 -_q_static void *
172 +static void *
173 q_profile_walk_at(int dir_fd, const char *dir, const char *file,
174 q_profile_callback_t callback, void *data)
175 {
176 @@ -69,7 +69,7 @@ q_profile_walk_at(int dir_fd, const char *dir, const char *file,
177 return data;
178 }
179
180 -_q_static void *
181 +static void *
182 q_profile_walk(const char *file, q_profile_callback_t callback, void *data)
183 {
184 /* Walk the profiles and read the file in question */
185
186 diff --git a/libq/safe_io.c b/libq/safe_io.c
187 index 059bcac..e5b958b 100644
188 --- a/libq/safe_io.c
189 +++ b/libq/safe_io.c
190 @@ -7,8 +7,8 @@
191
192 #include <stdio.h>
193
194 -size_t safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
195 -size_t safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
196 +static size_t
197 +safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
198 {
199 size_t ret = 0, this_ret;
200
201
202 diff --git a/libq/scandirat.c b/libq/scandirat.c
203 index 65d1012..f0b3201 100644
204 --- a/libq/scandirat.c
205 +++ b/libq/scandirat.c
206 @@ -20,7 +20,8 @@
207 # define reclen(de) (sizeof(*(de)) + strlen((de)->d_name))
208 #endif
209
210 -static int scandirat(int dir_fd, const char *dir, struct dirent ***dirlist,
211 +static int
212 +scandirat(int dir_fd, const char *dir, struct dirent ***dirlist,
213 int (*filter)(const struct dirent *),
214 int (*compar)(const struct dirent **, const struct dirent **))
215 {
216 @@ -59,7 +60,8 @@ static int scandirat(int dir_fd, const char *dir, struct dirent ***dirlist,
217
218 #endif
219
220 -_q_static void scandir_free(struct dirent **de, int cnt)
221 +static void
222 +scandir_free(struct dirent **de, int cnt)
223 {
224 if (cnt <= 0)
225 return;
226
227 diff --git a/libq/vdb.c b/libq/vdb.c
228 index 4b7d911..d42cdac 100644
229 --- a/libq/vdb.c
230 +++ b/libq/vdb.c
231 @@ -15,7 +15,8 @@ typedef struct {
232 DIR *dir;
233 } q_vdb_ctx;
234
235 -_q_static q_vdb_ctx *q_vdb_open(/*const char *sroot, const char *svdb*/void)
236 +static q_vdb_ctx *
237 +q_vdb_open(/*const char *sroot, const char *svdb*/void)
238 {
239 q_vdb_ctx *ctx = xmalloc(sizeof(*ctx));
240 const char *sroot = NULL;
241 @@ -57,7 +58,8 @@ _q_static q_vdb_ctx *q_vdb_open(/*const char *sroot, const char *svdb*/void)
242 return NULL;
243 }
244
245 -_q_static void q_vdb_close(q_vdb_ctx *ctx)
246 +static void
247 +q_vdb_close(q_vdb_ctx *ctx)
248 {
249 closedir(ctx->dir);
250 /* closedir() above does this for us: */
251 @@ -77,7 +79,8 @@ typedef struct {
252 const q_vdb_ctx *ctx;
253 } q_vdb_cat_ctx;
254
255 -_q_static int q_vdb_filter_cat(const struct dirent *de)
256 +static int
257 +q_vdb_filter_cat(const struct dirent *de)
258 {
259 int i;
260
261 @@ -108,7 +111,8 @@ _q_static int q_vdb_filter_cat(const struct dirent *de)
262 return i;
263 }
264
265 -_q_static q_vdb_cat_ctx *q_vdb_open_cat(q_vdb_ctx *ctx, const char *name)
266 +static q_vdb_cat_ctx *
267 +q_vdb_open_cat(q_vdb_ctx *ctx, const char *name)
268 {
269 q_vdb_cat_ctx *cat_ctx;
270 int fd;
271 @@ -133,7 +137,8 @@ _q_static q_vdb_cat_ctx *q_vdb_open_cat(q_vdb_ctx *ctx, const char *name)
272 return cat_ctx;
273 }
274
275 -_q_static q_vdb_cat_ctx *q_vdb_next_cat(q_vdb_ctx *ctx)
276 +static q_vdb_cat_ctx *
277 +q_vdb_next_cat(q_vdb_ctx *ctx)
278 {
279 /* search for a category directory */
280 q_vdb_cat_ctx *cat_ctx;
281 @@ -156,7 +161,8 @@ _q_static q_vdb_cat_ctx *q_vdb_next_cat(q_vdb_ctx *ctx)
282 return cat_ctx;
283 }
284
285 -_q_static void q_vdb_close_cat(q_vdb_cat_ctx *cat_ctx)
286 +static void
287 +q_vdb_close_cat(q_vdb_cat_ctx *cat_ctx)
288 {
289 closedir(cat_ctx->dir);
290 /* closedir() above does this for us: */
291 @@ -176,7 +182,8 @@ typedef struct {
292 q_vdb_cat_ctx *cat_ctx;
293 } q_vdb_pkg_ctx;
294
295 -_q_static int q_vdb_filter_pkg(const struct dirent *de)
296 +static int
297 +q_vdb_filter_pkg(const struct dirent *de)
298 {
299 #ifdef DT_UNKNOWN
300 if (de->d_type != DT_UNKNOWN &&
301 @@ -191,7 +198,8 @@ _q_static int q_vdb_filter_pkg(const struct dirent *de)
302 return 1;
303 }
304
305 -_q_static q_vdb_pkg_ctx *q_vdb_open_pkg(q_vdb_cat_ctx *cat_ctx, const char *name)
306 +static q_vdb_pkg_ctx *
307 +q_vdb_open_pkg(q_vdb_cat_ctx *cat_ctx, const char *name)
308 {
309 q_vdb_pkg_ctx *pkg_ctx = xmalloc(sizeof(*pkg_ctx));
310 pkg_ctx->name = name;
311 @@ -202,7 +210,8 @@ _q_static q_vdb_pkg_ctx *q_vdb_open_pkg(q_vdb_cat_ctx *cat_ctx, const char *name
312 return pkg_ctx;
313 }
314
315 -_q_static q_vdb_pkg_ctx *q_vdb_next_pkg(q_vdb_cat_ctx *cat_ctx)
316 +static q_vdb_pkg_ctx *
317 +q_vdb_next_pkg(q_vdb_cat_ctx *cat_ctx)
318 {
319 q_vdb_pkg_ctx *pkg_ctx;
320 const struct dirent *de;
321 @@ -224,7 +233,7 @@ _q_static q_vdb_pkg_ctx *q_vdb_next_pkg(q_vdb_cat_ctx *cat_ctx)
322 return pkg_ctx;
323 }
324
325 -_q_static int
326 +static int
327 q_vdb_pkg_openat(q_vdb_pkg_ctx *pkg_ctx, const char *file, int flags, mode_t mode)
328 {
329 if (pkg_ctx->fd == -1) {
330 @@ -236,7 +245,8 @@ q_vdb_pkg_openat(q_vdb_pkg_ctx *pkg_ctx, const char *file, int flags, mode_t mod
331 return openat(pkg_ctx->fd, file, flags|O_CLOEXEC, mode);
332 }
333
334 -_q_static FILE *q_vdb_pkg_fopenat(q_vdb_pkg_ctx *pkg_ctx, const char *file,
335 +static FILE *
336 +q_vdb_pkg_fopenat(q_vdb_pkg_ctx *pkg_ctx, const char *file,
337 int flags, mode_t mode, const char *fmode)
338 {
339 FILE *fp;
340 @@ -255,7 +265,7 @@ _q_static FILE *q_vdb_pkg_fopenat(q_vdb_pkg_ctx *pkg_ctx, const char *file,
341 #define q_vdb_pkg_fopenat_ro(pkg_ctx, file) q_vdb_pkg_fopenat(pkg_ctx, file, O_RDONLY, 0, "r")
342 #define q_vdb_pkg_fopenat_rw(pkg_ctx, file) q_vdb_pkg_fopenat(pkg_ctx, file, O_RDWR|O_CREAT|O_TRUNC, 0644, "w")
343
344 -_q_static bool
345 +static bool
346 q_vdb_pkg_eat(q_vdb_pkg_ctx *pkg_ctx, const char *file, char **bufptr, size_t *buflen)
347 {
348 int fd = q_vdb_pkg_openat(pkg_ctx, file, O_RDONLY, 0);
349 @@ -266,7 +276,8 @@ q_vdb_pkg_eat(q_vdb_pkg_ctx *pkg_ctx, const char *file, char **bufptr, size_t *b
350 return ret;
351 }
352
353 -_q_static void q_vdb_close_pkg(q_vdb_pkg_ctx *pkg_ctx)
354 +static void
355 +q_vdb_close_pkg(q_vdb_pkg_ctx *pkg_ctx)
356 {
357 if (pkg_ctx->fd != -1)
358 close(pkg_ctx->fd);
359 @@ -282,7 +293,8 @@ _q_static void q_vdb_close_pkg(q_vdb_pkg_ctx *pkg_ctx)
360 typedef int (q_vdb_pkg_cb)(q_vdb_pkg_ctx *, void *priv);
361 typedef int (q_vdb_cat_filter)(q_vdb_cat_ctx *, void *priv);
362
363 -_q_static int q_vdb_foreach_pkg(q_vdb_pkg_cb callback, void *priv, q_vdb_cat_filter filter)
364 +static int
365 +q_vdb_foreach_pkg(q_vdb_pkg_cb callback, void *priv, q_vdb_cat_filter filter)
366 {
367 q_vdb_ctx *ctx;
368 q_vdb_cat_ctx *cat_ctx;
369 @@ -306,7 +318,8 @@ _q_static int q_vdb_foreach_pkg(q_vdb_pkg_cb callback, void *priv, q_vdb_cat_fil
370 return ret;
371 }
372
373 -_q_static int q_vdb_foreach_pkg_sorted(q_vdb_pkg_cb callback, void *priv)
374 +static int
375 +q_vdb_foreach_pkg_sorted(q_vdb_pkg_cb callback, void *priv)
376 {
377 q_vdb_ctx *ctx;
378 q_vdb_cat_ctx *cat_ctx;
379
380 diff --git a/libq/vdb_get_next_dir.c b/libq/vdb_get_next_dir.c
381 index b264e7c..c47252b 100644
382 --- a/libq/vdb_get_next_dir.c
383 +++ b/libq/vdb_get_next_dir.c
384 @@ -1,4 +1,5 @@
385 -_q_static struct dirent *q_vdb_get_next_dir(DIR *dir)
386 +static struct dirent *
387 +q_vdb_get_next_dir(DIR *dir)
388 {
389 /* search for a category directory */
390 struct dirent *ret;
391
392 diff --git a/libq/virtuals.c b/libq/virtuals.c
393 index 1818281..2112965 100644
394 --- a/libq/virtuals.c
395 +++ b/libq/virtuals.c
396 @@ -19,7 +19,7 @@ struct queue_t {
397
398 typedef struct queue_t queue;
399
400 -_q_static queue *
401 +static queue *
402 append_set(queue *q, queue *ll)
403 {
404 queue *z;
405 @@ -36,7 +36,7 @@ append_set(queue *q, queue *ll)
406 }
407
408 /* add a set to a cache */
409 -_q_static queue *
410 +static queue *
411 add_set(const char *name, queue *q)
412 {
413 queue *ll = xmalloc(sizeof(*ll));
414 @@ -47,7 +47,7 @@ add_set(const char *name, queue *q)
415 }
416
417 /* Performance here is terrible. Should use a hash at some point. */
418 -_q_static queue *
419 +static queue *
420 add_set_unique(const char *name, queue *q, bool *ok)
421 {
422 queue *ll = q;
423 @@ -63,7 +63,7 @@ add_set_unique(const char *name, queue *q, bool *ok)
424 }
425
426 /* remove a set from a cache. matches ->name and frees name,item */
427 -_q_static queue *
428 +static queue *
429 del_set(char *s, queue *q, int *ok)
430 {
431 queue *ll, *list, *old;
432 @@ -96,7 +96,7 @@ del_set(char *s, queue *q, int *ok)
433 }
434
435 /* clear out a list */
436 -_q_static void
437 +static void
438 free_sets(queue *list)
439 {
440 queue *ll, *q;
441 @@ -109,10 +109,12 @@ free_sets(queue *list)
442 }
443 }
444
445 -void print_sets(const queue *list);
446 -void print_sets(const queue *list)
447 +#ifdef EBUG
448 +static void
449 +print_sets(const queue *list)
450 {
451 const queue *ll;
452 for (ll = list; ll != NULL; ll = ll->next)
453 puts(ll->name);
454 }
455 +#endif
456
457 diff --git a/libq/xchdir.c b/libq/xchdir.c
458 index 242b04a..6d93305 100644
459 --- a/libq/xchdir.c
460 +++ b/libq/xchdir.c
461 @@ -7,8 +7,8 @@
462
463 #include <unistd.h>
464
465 -void xchdir(const char *path);
466 -void xchdir(const char *path)
467 +static void
468 +xchdir(const char *path)
469 {
470 if (unlikely(chdir(path) != 0))
471 errp("chdir(%s) failed", path);
472
473 diff --git a/libq/xmkdir.c b/libq/xmkdir.c
474 index b47d44c..265cb5b 100644
475 --- a/libq/xmkdir.c
476 +++ b/libq/xmkdir.c
477 @@ -1,5 +1,6 @@
478 /* Emulate `mkdir -p -m MODE PATH` */
479 -static int mkdir_p_at(int dfd, const char *path, mode_t mode)
480 +static int
481 +mkdir_p_at(int dfd, const char *path, mode_t mode)
482 {
483 char *_p, *p, *s;
484
485 @@ -35,13 +36,15 @@ static int mkdir_p_at(int dfd, const char *path, mode_t mode)
486
487 return 0;
488 }
489 -static int mkdir_p(const char *path, mode_t mode)
490 +static int
491 +mkdir_p(const char *path, mode_t mode)
492 {
493 return mkdir_p_at(AT_FDCWD, path, mode);
494 }
495
496 /* Emulate `rm -rf PATH` */
497 -_q_static int rm_rf_at(int dfd, const char *path)
498 +static int
499 +rm_rf_at(int dfd, const char *path)
500 {
501 int subdfd;
502 DIR *dir;
503 @@ -75,7 +78,8 @@ _q_static int rm_rf_at(int dfd, const char *path)
504 return 0;
505 }
506
507 -_q_static int rm_rf(const char *path)
508 +static int
509 +rm_rf(const char *path)
510 {
511 rm_rf_at(AT_FDCWD, path);
512
513 @@ -91,7 +95,8 @@ _q_static int rm_rf(const char *path)
514 return -1;
515 }
516
517 -_q_static int rmdir_r_at(int dfd, const char *path)
518 +static int
519 +rmdir_r_at(int dfd, const char *path)
520 {
521 size_t len;
522 char *p, *e;
523 @@ -113,7 +118,8 @@ _q_static int rmdir_r_at(int dfd, const char *path)
524 }
525
526 /*
527 -_q_static int rmdir_r(const char *path)
528 +static int
529 +rmdir_r(const char *path)
530 {
531 return rmdir_r_at(AT_FDCWD, path);
532 }
533
534 diff --git a/main.c b/main.c
535 index 9921363..33db01a 100644
536 --- a/main.c
537 +++ b/main.c
538 @@ -13,16 +13,11 @@
539 static bool eat_file(const char *, char **, size_t *);
540 static bool eat_file_fd(int, char **, size_t *);
541 static bool eat_file_at(int, const char *, char **, size_t *);
542 -int rematch(const char *, const char *, int);
543 +static int rematch(const char *, const char *, int);
544 static char *rmspace(char *);
545 static char *rmspace_len(char *, size_t);
546
547 -void initialize_portage_env(void);
548 -void initialize_ebuild_flat(void);
549 -void reinitialize_ebuild_flat(void);
550 -void reinitialize_as_needed(void);
551 -void cleanup(void);
552 -int lookup_applet_idx(const char *);
553 +static int lookup_applet_idx(const char *);
554
555 /* variables to control runtime behavior */
556 char *module_name = NULL;
557 @@ -60,8 +55,8 @@ static const char *argv0;
558
559 #ifdef EBUG
560 # include <sys/resource.h>
561 -void init_coredumps(void);
562 -void init_coredumps(void)
563 +static void
564 +init_coredumps(void)
565 {
566 struct rlimit rl;
567 rl.rlim_cur = RLIM_INFINITY;
568 @@ -75,8 +70,8 @@ void init_coredumps(void)
569
570 static DECLARE_ARRAY(overlays);
571
572 -_q_static
573 -void no_colors(void)
574 +static void
575 +no_colors(void)
576 {
577 /* echo $(awk '{print $4,"="}' libq/colors.c | grep ^* |cut -c 2-| grep ^[A-Z] |tr '\n' ' ') = \"\"\; */
578 BOLD = NORM = BLUE = DKBLUE = CYAN = GREEN = DKGREEN = MAGENTA = RED = YELLOW = BRYELLOW = WHITE = "";
579 @@ -114,8 +109,9 @@ void no_colors(void)
580 default: applet ## _usage(EXIT_FAILURE); break;
581
582 /* display usage and exit */
583 -static void usage(int status, const char *flags, struct option const opts[],
584 - const char * const help[], const char *desc, int blabber)
585 +static void
586 +usage(int status, const char *flags, struct option const opts[],
587 + const char * const help[], const char *desc, int blabber)
588 {
589 const char opt_arg[] = "[arg]";
590 const char a_arg[] = "<arg>";
591 @@ -181,7 +177,8 @@ static void usage(int status, const char *flags, struct option const opts[],
592 exit(status);
593 }
594
595 -static void version_barf(void)
596 +static void
597 +version_barf(void)
598 {
599 #ifndef VERSION
600 # define VERSION "git"
601 @@ -195,7 +192,8 @@ static void version_barf(void)
602 exit(EXIT_SUCCESS);
603 }
604
605 -static bool eat_file_fd(int fd, char **bufptr, size_t *bufsize)
606 +static bool
607 +eat_file_fd(int fd, char **bufptr, size_t *bufsize)
608 {
609 bool ret = true;
610 struct stat s;
611 @@ -243,7 +241,8 @@ static bool eat_file_fd(int fd, char **bufptr, size_t *bufsize)
612 return ret;
613 }
614
615 -static bool eat_file_at(int dfd, const char *file, char **bufptr, size_t *bufsize)
616 +static bool
617 +eat_file_at(int dfd, const char *file, char **bufptr, size_t *bufsize)
618 {
619 bool ret;
620 int fd;
621 @@ -256,12 +255,14 @@ static bool eat_file_at(int dfd, const char *file, char **bufptr, size_t *bufsiz
622 return ret;
623 }
624
625 -static bool eat_file(const char *file, char **bufptr, size_t *bufsize)
626 +static bool
627 +eat_file(const char *file, char **bufptr, size_t *bufsize)
628 {
629 return eat_file_at(AT_FDCWD, file, bufptr, bufsize);
630 }
631
632 -static bool prompt(const char *p)
633 +static bool
634 +prompt(const char *p)
635 {
636 printf("%s? [Y/n] ", p);
637 fflush(stdout);
638 @@ -275,7 +276,8 @@ static bool prompt(const char *p)
639 }
640 }
641
642 -int rematch(const char *re, const char *match, int cflags)
643 +static int
644 +rematch(const char *re, const char *match, int cflags)
645 {
646 regex_t preg;
647 int ret;
648 @@ -292,8 +294,8 @@ int rematch(const char *re, const char *match, int cflags)
649 }
650
651 /* removes adjacent extraneous white space */
652 -static char *remove_extra_space(char *str);
653 -static char *remove_extra_space(char *str)
654 +static char *
655 +remove_extra_space(char *str)
656 {
657 char *p, c = ' ';
658 size_t len, pos = 0;
659 @@ -317,14 +319,16 @@ static char *remove_extra_space(char *str)
660 return str;
661 }
662
663 -static void freeargv(int argc, char **argv)
664 +static void
665 +freeargv(int argc, char **argv)
666 {
667 while (argc--)
668 free(argv[argc]);
669 free(argv);
670 }
671
672 -static void makeargv(const char *string, int *argc, char ***argv)
673 +static void
674 +makeargv(const char *string, int *argc, char ***argv)
675 {
676 int curc = 2;
677 char *q, *p, *str;
678 @@ -369,8 +373,8 @@ typedef struct {
679 long mtime;
680 } contents_entry;
681
682 -contents_entry *contents_parse_line(char *line);
683 -contents_entry *contents_parse_line(char *line)
684 +static contents_entry *
685 +contents_parse_line(char *line)
686 {
687 static contents_entry e;
688 char *p;
689 @@ -444,7 +448,8 @@ contents_entry *contents_parse_line(char *line)
690 }
691
692 /* Handle a single file in the repos.conf format. */
693 -static void read_one_repos_conf(const char *repos_conf)
694 +static void
695 +read_one_repos_conf(const char *repos_conf)
696 {
697 int nsec;
698 char *conf;
699 @@ -478,7 +483,8 @@ static void read_one_repos_conf(const char *repos_conf)
700 }
701
702 /* Handle a possible directory of files. */
703 -static void read_repos_conf(const char *configroot, const char *repos_conf)
704 +static void
705 +read_repos_conf(const char *configroot, const char *repos_conf)
706 {
707 char *top_conf, *sub_conf;
708 int i, count;
709 @@ -526,7 +532,8 @@ static void read_repos_conf(const char *configroot, const char *repos_conf)
710 free(top_conf);
711 }
712
713 -static void strincr_var(const char *name, const char *s, char **value, size_t *value_len)
714 +static void
715 +strincr_var(const char *name, const char *s, char **value, size_t *value_len)
716 {
717 size_t len;
718 char *buf, *p, *nv;
719 @@ -584,7 +591,8 @@ typedef struct {
720 const char *default_value;
721 } env_vars;
722
723 -_q_static env_vars *get_portage_env_var(env_vars *vars, const char *name)
724 +static env_vars *
725 +get_portage_env_var(env_vars *vars, const char *name)
726 {
727 size_t i;
728
729 @@ -595,7 +603,8 @@ _q_static env_vars *get_portage_env_var(env_vars *vars, const char *name)
730 return NULL;
731 }
732
733 -_q_static void set_portage_env_var(env_vars *var, const char *value)
734 +static void
735 +set_portage_env_var(env_vars *var, const char *value)
736 {
737 switch (var->type) {
738 case _Q_BOOL:
739 @@ -612,7 +621,8 @@ _q_static void set_portage_env_var(env_vars *var, const char *value)
740 }
741
742 /* Helper to read a portage env file (e.g. make.conf) */
743 -_q_static void read_portage_env_file(const char *configroot, const char *file, env_vars vars[])
744 +static void
745 +read_portage_env_file(const char *configroot, const char *file, env_vars vars[])
746 {
747 size_t i, buflen, line, configroot_len, file_len;
748 FILE *fp;
749 @@ -729,7 +739,8 @@ _q_static void read_portage_env_file(const char *configroot, const char *file, e
750 }
751
752 /* Helper to recursively read stacked make.defaults in profiles */
753 -static void read_portage_profile(const char *configroot, const char *profile, env_vars vars[])
754 +static void
755 +read_portage_profile(const char *configroot, const char *profile, env_vars vars[])
756 {
757 size_t configroot_len, profile_len, sub_len;
758 char *profile_file, *sub_file;
759 @@ -770,7 +781,8 @@ static void read_portage_profile(const char *configroot, const char *profile, en
760 free(profile_file);
761 }
762
763 -void initialize_portage_env(void)
764 +static void
765 +initialize_portage_env(void)
766 {
767 size_t i;
768 const char *s;
769 @@ -955,8 +967,8 @@ enum {
770 CACHE_METADATA_MD5 = 11,
771 };
772
773 -int filter_hidden(const struct dirent *dentry);
774 -int filter_hidden(const struct dirent *dentry)
775 +static int
776 +filter_hidden(const struct dirent *dentry)
777 {
778 if (dentry->d_name[0] == '.')
779 return 0;
780 @@ -1094,7 +1106,8 @@ ret:
781 return cache_file;
782 }
783
784 -void reinitialize_as_needed(void)
785 +static void
786 +reinitialize_as_needed(void)
787 {
788 size_t n;
789 const char *overlay, *ret = ret;
790 @@ -1140,12 +1153,12 @@ typedef struct {
791 char *_md5_;
792 } portage_cache;
793
794 -void cache_free(portage_cache *cache);
795 -portage_cache *cache_read_file_pms(const char *file);
796 -portage_cache *cache_read_file_md5(const char *file);
797 -portage_cache *cache_read_file(const char *file);
798 +static void cache_free(portage_cache *cache);
799 +static portage_cache *cache_read_file_pms(const char *file);
800 +static portage_cache *cache_read_file_md5(const char *file);
801
802 -portage_cache *cache_read_file(const char *file)
803 +static portage_cache *
804 +cache_read_file(const char *file)
805 {
806 if (portcachedir_type == CACHE_METADATA_MD5)
807 return(cache_read_file_md5(file));
808 @@ -1155,7 +1168,8 @@ portage_cache *cache_read_file(const char *file)
809 return NULL;
810 }
811
812 -portage_cache *cache_read_file_pms(const char *file)
813 +static portage_cache *
814 +cache_read_file_pms(const char *file)
815 {
816 struct stat s;
817 char *ptr;
818 @@ -1213,7 +1227,8 @@ err:
819 return NULL;
820 }
821
822 -portage_cache *cache_read_file_md5(const char *file)
823 +static portage_cache *
824 +cache_read_file_md5(const char *file)
825 {
826 struct stat s;
827 char *ptr, *endptr;
828 @@ -1311,8 +1326,9 @@ err:
829 return NULL;
830 }
831
832 -void cache_dump(portage_cache *cache);
833 -void cache_dump(portage_cache *cache)
834 +#ifdef EBUG
835 +static void
836 +cache_dump(portage_cache *cache)
837 {
838 if (!cache)
839 errf("Cache is empty !");
840 @@ -1339,8 +1355,10 @@ void cache_dump(portage_cache *cache)
841 printf("PV : %s\n", cache->atom->PV);
842 printf("PVR : %s\n", cache->atom->PVR);
843 }
844 +#endif
845
846 -void cache_free(portage_cache *cache)
847 +static void
848 +cache_free(portage_cache *cache)
849 {
850 if (!cache)
851 errf("Cache is empty !");
852 @@ -1348,13 +1366,14 @@ void cache_free(portage_cache *cache)
853 free(cache);
854 }
855
856 -char *atom_to_pvr(depend_atom *atom);
857 -char *atom_to_pvr(depend_atom *atom) {
858 +static char *
859 +atom_to_pvr(depend_atom *atom) {
860 return (atom->PR_int == 0 ? atom->P : atom->PVR );
861 }
862
863 /* TODO: Merge this into libq/vdb.c somehow. */
864 -_q_static queue *get_vdb_atoms(int fullcpv)
865 +static queue *
866 +get_vdb_atoms(int fullcpv)
867 {
868 q_vdb_ctx *ctx;
869
870 @@ -1421,7 +1440,8 @@ _q_static queue *get_vdb_atoms(int fullcpv)
871 return cpf;
872 }
873
874 -void cleanup(void)
875 +static void
876 +cleanup(void)
877 {
878 reinitialize_as_needed();
879 }
880
881 diff --git a/main.h b/main.h
882 index d3df8b1..9f28f80 100644
883 --- a/main.h
884 +++ b/main.h
885 @@ -6,10 +6,6 @@
886 * Copyright 2005-2014 Mike Frysinger - <vapier@g.o>
887 */
888
889 -#ifndef _q_static
890 -# define _q_static static
891 -#endif
892 -
893 /* make sure our buffers are as big as they can be */
894 #if PATH_MAX > _POSIX_PATH_MAX /* _Q_PATH_MAX */
895 # define _Q_PATH_MAX PATH_MAX
896
897 diff --git a/qatom.c b/qatom.c
898 index 8cdffb1..7f981c3 100644
899 --- a/qatom.c
900 +++ b/qatom.c
901 @@ -32,8 +32,8 @@ static const char * const qatom_opts_help[] = {
902 * pfx - the version qualifier if set (e.g. > < = !)
903 * sfx - the version qualifier if set (e.g. *)
904 */
905 -_q_static
906 -void qatom_printf(const char *format, const depend_atom *atom, int pverbose)
907 +static void
908 +qatom_printf(const char *format, const depend_atom *atom, int pverbose)
909 {
910 char bracket;
911 const char *fmt, *p;
912
913 diff --git a/qcache.c b/qcache.c
914 index c5421c7..7cd100e 100644
915 --- a/qcache.c
916 +++ b/qcache.c
917 @@ -81,8 +81,8 @@ enum { none = 0, testing, stable, minus };
918 * OUT:
919 * int - one of the following enum { none = 0, testing, stable, minus };
920 */
921 -_q_static
922 -int decode_status(char c)
923 +static int
924 +decode_status(char c)
925 {
926 switch (c) {
927 case '-': return minus;
928 @@ -101,8 +101,8 @@ int decode_status(char c)
929 * OUT:
930 * int pos - location of arch in archlist[]
931 */
932 -_q_static
933 -int decode_arch(const char *arch)
934 +static int
935 +decode_arch(const char *arch)
936 {
937 queue *q = arches;
938 int a;
939 @@ -132,8 +132,8 @@ int decode_arch(const char *arch)
940 * char *category - current category of the current package
941 * int *keywords - an array of keywords that coincides with archlist
942 */
943 -_q_static
944 -void print_keywords(const char *category, const char *ebuild, int *keywords)
945 +static void
946 +print_keywords(const char *category, const char *ebuild, int *keywords)
947 {
948 queue *arch = arches;
949 int a;
950 @@ -170,8 +170,8 @@ void print_keywords(const char *category, const char *ebuild, int *keywords)
951 * ERR:
952 * int rc - -1 is returned on error (if !s || !keywords)
953 */
954 -_q_static
955 -int read_keywords(char *s, int *keywords)
956 +static int
957 +read_keywords(char *s, int *keywords)
958 {
959 char *arch, delim[2] = { ' ', '\0' };
960 size_t slen;
961 @@ -213,8 +213,8 @@ int read_keywords(char *s, int *keywords)
962 * ERR:
963 * NULL is returned when an error occurs.
964 */
965 -_q_static
966 -portage_cache *qcache_read_cache_file(const char *filename)
967 +static portage_cache *
968 +qcache_read_cache_file(const char *filename)
969 {
970 struct stat s;
971 char *buf;
972 @@ -297,8 +297,8 @@ portage_cache *qcache_read_cache_file(const char *filename)
973 * IN:
974 * portage_cache *cache - the portage_cache to be free()'d
975 */
976 -_q_static
977 -void qcache_free_data(portage_cache *cache)
978 +static void
979 +qcache_free_data(portage_cache *cache)
980 {
981 int i;
982 char **c;
983 @@ -331,8 +331,8 @@ void qcache_free_data(portage_cache *cache)
984 * 1 (OLDER)
985 * 0 (SAME)
986 */
987 -_q_static
988 -int qcache_vercmp(const struct dirent **x, const struct dirent **y)
989 +static int
990 +qcache_vercmp(const struct dirent **x, const struct dirent **y)
991 {
992 switch (atom_compare_str((*x)->d_name, (*y)->d_name)) {
993 case NEWER: return -1;
994 @@ -356,8 +356,8 @@ int qcache_vercmp(const struct dirent **x, const struct dirent **y)
995 * OUT:
996 * int - 0 if filename begins with '.' or is "metadata.xml", otherwise 1
997 */
998 -_q_static
999 -int qcache_file_select(const struct dirent *entry)
1000 +static int
1001 +qcache_file_select(const struct dirent *entry)
1002 {
1003 return !(entry->d_name[0] == '.' || (strcmp(entry->d_name, "metadata.xml") == 0) || (strstr(entry->d_name, ".cpickle") != 0));
1004 }
1005 @@ -372,8 +372,8 @@ int qcache_file_select(const struct dirent *entry)
1006 * OUT:
1007 * int - 1 if the filename ends in ".ebuild", otherwise 0
1008 */
1009 -_q_static
1010 -int qcache_ebuild_select(const struct dirent *entry)
1011 +static int
1012 +qcache_ebuild_select(const struct dirent *entry)
1013 {
1014 return ((strlen(entry->d_name) > 7) && !strcmp(entry->d_name+strlen(entry->d_name)-7, ".ebuild"));
1015 }
1016 @@ -382,7 +382,7 @@ int qcache_ebuild_select(const struct dirent *entry)
1017 /* Traversal function */
1018 /********************************************************************/
1019
1020 -_q_static void qcache_load_arches(const char *overlay);
1021 +static void qcache_load_arches(const char *overlay);
1022
1023 /*
1024 * int qcache_traverse(void (*func)(qcache_data*));
1025 @@ -396,8 +396,8 @@ _q_static void qcache_load_arches(const char *overlay);
1026 * ERR:
1027 * exit or return -1 on failure.
1028 */
1029 -_q_static
1030 -int qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay)
1031 +static int
1032 +qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay)
1033 {
1034 qcache_data data = {
1035 .overlay = overlay,
1036 @@ -507,8 +507,8 @@ int qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay)
1037 return 0;
1038 }
1039
1040 -_q_static
1041 -int qcache_traverse(void (*func)(qcache_data*))
1042 +static int
1043 +qcache_traverse(void (*func)(qcache_data*))
1044 {
1045 int ret;
1046 size_t n;
1047 @@ -532,8 +532,8 @@ int qcache_traverse(void (*func)(qcache_data*))
1048 /* functors */
1049 /********************************************************************/
1050
1051 -_q_static
1052 -void qcache_imlate(qcache_data *data)
1053 +static void
1054 +qcache_imlate(qcache_data *data)
1055 {
1056 int *keywords;
1057 int a;
1058 @@ -569,8 +569,8 @@ void qcache_imlate(qcache_data *data)
1059 free(keywords);
1060 }
1061
1062 -_q_static
1063 -void qcache_not(qcache_data *data)
1064 +static void
1065 +qcache_not(qcache_data *data)
1066 {
1067 int *keywords;
1068
1069 @@ -596,8 +596,8 @@ void qcache_not(qcache_data *data)
1070 free(keywords);
1071 }
1072
1073 -_q_static
1074 -void qcache_all(qcache_data *data)
1075 +static void
1076 +qcache_all(qcache_data *data)
1077 {
1078 int *keywords;
1079
1080 @@ -622,8 +622,8 @@ void qcache_all(qcache_data *data)
1081 free(keywords);
1082 }
1083
1084 -_q_static
1085 -void qcache_dropped(qcache_data *data)
1086 +static void
1087 +qcache_dropped(qcache_data *data)
1088 {
1089 static int possible = 0;
1090 int *keywords, i;
1091 @@ -668,8 +668,8 @@ void qcache_dropped(qcache_data *data)
1092 free(keywords);
1093 }
1094
1095 -_q_static
1096 -void qcache_stats(qcache_data *data)
1097 +static void
1098 +qcache_stats(qcache_data *data)
1099 {
1100 static time_t runtime;
1101 static queue *allcats;
1102 @@ -820,8 +820,8 @@ void qcache_stats(qcache_data *data)
1103 }
1104 }
1105
1106 -_q_static
1107 -void qcache_testing_only(qcache_data *data)
1108 +static void
1109 +qcache_testing_only(qcache_data *data)
1110 {
1111 static int possible = 0;
1112 int *keywords;
1113 @@ -863,8 +863,8 @@ void qcache_testing_only(qcache_data *data)
1114 /* Misc functions */
1115 /********************************************************************/
1116
1117 -_q_static
1118 -void qcache_load_arches(const char *overlay)
1119 +static void
1120 +qcache_load_arches(const char *overlay)
1121 {
1122 FILE *fp;
1123 char *filename, *s;
1124 @@ -906,8 +906,8 @@ void qcache_load_arches(const char *overlay)
1125 *
1126 * Deallocate variables (archlist)
1127 */
1128 -_q_static
1129 -void qcache_free(void)
1130 +static void
1131 +qcache_free(void)
1132 {
1133 free_sets(arches);
1134 }
1135
1136 diff --git a/qcheck.c b/qcheck.c
1137 index 40968a6..26b820e 100644
1138 --- a/qcheck.c
1139 +++ b/qcheck.c
1140 @@ -47,7 +47,8 @@ struct qcheck_opt_state {
1141 bool undo_prelink;
1142 };
1143
1144 -static int qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state)
1145 +static int
1146 +qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state)
1147 {
1148 int fd;
1149 FILE *fp, *fpx;
1150 @@ -305,7 +306,8 @@ static int qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_sta
1151 return EXIT_SUCCESS;
1152 }
1153
1154 -_q_static int qcheck_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1155 +static int
1156 +qcheck_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1157 {
1158 struct qcheck_opt_state *state = priv;
1159 const char *catname = pkg_ctx->cat_ctx->name;
1160
1161 diff --git a/qdepends.c b/qdepends.c
1162 index 3c90863..a614704 100644
1163 --- a/qdepends.c
1164 +++ b/qdepends.c
1165 @@ -66,17 +66,15 @@ static const dep_node null_node = {
1166 #else
1167 # define dep_dump_tree(r) _dep_print_tree(stdout, r, 0)
1168 #endif
1169 -_q_static void _dep_print_tree(FILE *fp, const dep_node *root, size_t space);
1170 -void dep_burn_tree(dep_node *root);
1171 -char *dep_flatten_tree(const dep_node *root);
1172 -_q_static void _dep_attach(dep_node *root, dep_node *attach_me, int type);
1173 -_q_static void _dep_burn_node(dep_node *node);
1174 -int qdepends_main_vdb(const char *depend_file, int argc, char **argv);
1175 -int qdepends_vdb_deep(const char *depend_file, const char *query);
1176 +static void _dep_print_tree(FILE *fp, const dep_node *root, size_t space);
1177 +static void dep_burn_tree(dep_node *root);
1178 +static char *dep_flatten_tree(const dep_node *root);
1179 +static void _dep_attach(dep_node *root, dep_node *attach_me, int type);
1180 +static void _dep_burn_node(dep_node *node);
1181
1182 #ifdef EBUG
1183 -void print_word(const char *ptr, size_t num);
1184 -void print_word(const char *ptr, size_t num)
1185 +static void
1186 +print_word(const char *ptr, size_t num)
1187 {
1188 while (num--)
1189 printf("%c", *ptr++);
1190 @@ -84,7 +82,7 @@ void print_word(const char *ptr, size_t num)
1191 }
1192 #endif
1193
1194 -_q_static dep_node *
1195 +static dep_node *
1196 _dep_grow_node(dep_type type, const char *info, size_t info_len)
1197 {
1198 dep_node *ret;
1199 @@ -112,7 +110,8 @@ _dep_grow_node(dep_type type, const char *info, size_t info_len)
1200 return ret;
1201 }
1202
1203 -void _dep_burn_node(dep_node *node)
1204 +static void
1205 +_dep_burn_node(dep_node *node)
1206 {
1207 assert(node);
1208 if (node->info_on_heap) free(node->info);
1209 @@ -125,7 +124,8 @@ enum {
1210 _DEP_CHILD = 2
1211 };
1212
1213 -void _dep_attach(dep_node *root, dep_node *attach_me, int type)
1214 +static void
1215 +_dep_attach(dep_node *root, dep_node *attach_me, int type)
1216 {
1217 if (type == _DEP_NEIGH) {
1218 if (!root->neighbor) {
1219 @@ -142,7 +142,8 @@ void _dep_attach(dep_node *root, dep_node *attach_me, int type)
1220 }
1221 }
1222
1223 -_q_static dep_node *dep_grow_tree(const char *depend)
1224 +static dep_node *
1225 +dep_grow_tree(const char *depend)
1226 {
1227 bool saw_whitespace;
1228 signed long paren_balanced;
1229 @@ -160,8 +161,6 @@ _q_static dep_node *dep_grow_tree(const char *depend)
1230 #define _maybe_consume_word(t) \
1231 do { \
1232 if (!word) break; \
1233 - /*printf("Found word:%i ", curr_attach);*/ \
1234 - /*print_word(word, ptr-word);*/ \
1235 new_node = _dep_grow_node(t, word, ptr-word); \
1236 if (!ret) \
1237 ret = curr_node = new_node; \
1238 @@ -269,7 +268,8 @@ error_out:
1239 return NULL;
1240 }
1241
1242 -_q_static void _dep_print_tree(FILE *fp, const dep_node *root, size_t space)
1243 +static void
1244 +_dep_print_tree(FILE *fp, const dep_node *root, size_t space)
1245 {
1246 size_t s;
1247
1248 @@ -306,7 +306,8 @@ _q_static void _dep_print_tree(FILE *fp, const dep_node *root, size_t space)
1249 _dep_print_tree(fp, root->neighbor, space);
1250 }
1251
1252 -_q_static bool dep_print_depend(FILE *fp, const char *depend)
1253 +static bool
1254 +dep_print_depend(FILE *fp, const char *depend)
1255 {
1256 dep_node *dep_tree;
1257
1258 @@ -326,7 +327,8 @@ _q_static bool dep_print_depend(FILE *fp, const char *depend)
1259 return true;
1260 }
1261
1262 -void dep_burn_tree(dep_node *root)
1263 +static void
1264 +dep_burn_tree(dep_node *root)
1265 {
1266 assert(root);
1267 if (root->children) dep_burn_tree(root->children);
1268 @@ -334,7 +336,8 @@ void dep_burn_tree(dep_node *root)
1269 _dep_burn_node(root);
1270 }
1271
1272 -_q_static void dep_prune_use(dep_node *root, const char *use)
1273 +static void
1274 +dep_prune_use(dep_node *root, const char *use)
1275 {
1276 if (root->neighbor) dep_prune_use(root->neighbor, use);
1277 if (root->type == DEP_USE) {
1278 @@ -351,7 +354,7 @@ _q_static void dep_prune_use(dep_node *root, const char *use)
1279 if (root->children) dep_prune_use(root->children, use);
1280 }
1281
1282 -_q_static char *
1283 +static char *
1284 _dep_flatten_tree(const dep_node *root, char *buf)
1285 {
1286 if (root->type == DEP_NULL) goto this_node_sucks;
1287 @@ -367,7 +370,8 @@ this_node_sucks:
1288 return buf;
1289 }
1290
1291 -char *dep_flatten_tree(const dep_node *root)
1292 +static char *
1293 +dep_flatten_tree(const dep_node *root)
1294 {
1295 static char flat[1024 * 1024];
1296 char *buf = _dep_flatten_tree(root, flat);
1297 @@ -386,7 +390,8 @@ struct qdepends_opt_state {
1298 const char *query;
1299 };
1300
1301 -_q_static int qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1302 +static int
1303 +qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1304 {
1305 struct qdepends_opt_state *state = priv;
1306 const char *catname = pkg_ctx->cat_ctx->name;
1307 @@ -462,7 +467,8 @@ _q_static int qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1308 return ret;
1309 }
1310
1311 -_q_static int qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1312 +static int
1313 +qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1314 {
1315 struct qdepends_opt_state *state = priv;
1316 const char *catname = pkg_ctx->cat_ctx->name;
1317
1318 diff --git a/qfile.c b/qfile.c
1319 index c6c3664..ec08491 100644
1320 --- a/qfile.c
1321 +++ b/qfile.c
1322 @@ -65,7 +65,7 @@ struct qfile_opt_state {
1323 * We assume the people calling us have chdir(/var/db/pkg) and so
1324 * we use relative paths throughout here.
1325 */
1326 -_q_static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1327 +static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1328 {
1329 struct qfile_opt_state *state = priv;
1330 const char *catname = pkg_ctx->cat_ctx->name;
1331 @@ -238,7 +238,7 @@ _q_static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1332 return found;
1333 }
1334
1335 -_q_static void destroy_qfile_args(qfile_args_t *qfile_args)
1336 +static void destroy_qfile_args(qfile_args_t *qfile_args)
1337 {
1338 int i;
1339
1340 @@ -259,7 +259,7 @@ _q_static void destroy_qfile_args(qfile_args_t *qfile_args)
1341 memset(qfile_args, 0, sizeof(qfile_args_t));
1342 }
1343
1344 -_q_static int
1345 +static int
1346 prepare_qfile_args(const int argc, const char **argv, struct qfile_opt_state *state)
1347 {
1348 qfile_args_t *args = &state->args;
1349
1350 diff --git a/qglsa.c b/qglsa.c
1351 index 6670093..74c5d39 100644
1352 --- a/qglsa.c
1353 +++ b/qglsa.c
1354 @@ -33,8 +33,8 @@ typedef enum {
1355 GLSA_FUNKYTOWN, GLSA_LIST, GLSA_DUMP, GLSA_TEST, GLSA_FIX, GLSA_INJECT
1356 } qglsa_action;
1357
1358 -static char *qglsa_load_list(void);
1359 -static char *qglsa_load_list(void)
1360 +static char *
1361 +qglsa_load_list(void)
1362 {
1363 char *file, *ret = NULL;
1364 size_t size = 0;
1365 @@ -43,8 +43,8 @@ static char *qglsa_load_list(void)
1366 free(file);
1367 return ret;
1368 }
1369 -static void qglsa_append_to_list(const char *glsa);
1370 -static void qglsa_append_to_list(const char *glsa)
1371 +static void
1372 +qglsa_append_to_list(const char *glsa)
1373 {
1374 char *file;
1375 FILE *f;
1376 @@ -57,8 +57,8 @@ static void qglsa_append_to_list(const char *glsa)
1377 free(file);
1378 }
1379
1380 -static void qglsa_decode_entities(char *xml_buf, size_t len);
1381 -static void qglsa_decode_entities(char *xml_buf, size_t len)
1382 +static void
1383 +qglsa_decode_entities(char *xml_buf, size_t len)
1384 {
1385 const char const *encoded[] = { "&lt;", "&gt;", "&quot;", "&amp;"};
1386 const char const *decoded[] = { "<", ">", "\"", "&"};
1387 @@ -80,7 +80,8 @@ static void qglsa_decode_entities(char *xml_buf, size_t len)
1388 }
1389 }
1390
1391 -static char *qglsa_get_xml_tag_attribute(const char *xml_buf, const char *tag, const char *attribute)
1392 +static char *
1393 +qglsa_get_xml_tag_attribute(const char *xml_buf, const char *tag, const char *attribute)
1394 {
1395 static char tmp_buf[BUFSIZE];
1396 char *start, *end, *start_attr, *end_attr;
1397 @@ -114,7 +115,8 @@ static char *qglsa_get_xml_tag_attribute(const char *xml_buf, const char *tag, c
1398 qglsa_decode_entities(tmp_buf, end-start);
1399 return tmp_buf;
1400 }
1401 -static char *qglsa_get_xml_tag(const char *xml_buf, const char *tag)
1402 +static char *
1403 +qglsa_get_xml_tag(const char *xml_buf, const char *tag)
1404 {
1405 static char tmp_buf[BUFSIZE];
1406 char *start, *end;
1407
1408 diff --git a/qgrep.c b/qgrep.c
1409 index 73556ee..9d2752e 100644
1410 --- a/qgrep.c
1411 +++ b/qgrep.c
1412 @@ -48,8 +48,8 @@ static const char * const qgrep_opts_help[] = {
1413 };
1414 #define qgrep_usage(ret) usage(ret, QGREP_FLAGS, qgrep_long_opts, qgrep_opts_help, NULL, lookup_applet_idx("qgrep"))
1415
1416 -char qgrep_name_match(const char*, const int, depend_atom**);
1417 -char qgrep_name_match(const char* name, const int argc, depend_atom** argv)
1418 +static char
1419 +qgrep_name_match(const char* name, const int argc, depend_atom** argv)
1420 {
1421 depend_atom* atom;
1422 int i;
1423 @@ -89,8 +89,8 @@ typedef struct qgrep_buf {
1424
1425 /* Allocate <length> buffers in a circular list.
1426 * <length> must be at least 1. */
1427 -qgrep_buf_t* qgrep_buf_list_alloc(const char);
1428 -qgrep_buf_t* qgrep_buf_list_alloc(const char length)
1429 +static qgrep_buf_t *
1430 +qgrep_buf_list_alloc(const char length)
1431 {
1432 char i;
1433 qgrep_buf_t *head, *current;
1434 @@ -104,8 +104,8 @@ qgrep_buf_t* qgrep_buf_list_alloc(const char length)
1435 }
1436
1437 /* Free a circular buffers list. */
1438 -void qgrep_buf_list_free(qgrep_buf_t *);
1439 -void qgrep_buf_list_free(qgrep_buf_t *head)
1440 +static void
1441 +qgrep_buf_list_free(qgrep_buf_t *head)
1442 {
1443 qgrep_buf_t *current, *next;
1444 next = head;
1445 @@ -117,8 +117,8 @@ void qgrep_buf_list_free(qgrep_buf_t *head)
1446 }
1447
1448 /* Set valid=0 in the whole list. */
1449 -void qgrep_buf_list_invalidate(qgrep_buf_t *);
1450 -void qgrep_buf_list_invalidate(qgrep_buf_t *head)
1451 +static void
1452 +qgrep_buf_list_invalidate(qgrep_buf_t *head)
1453 {
1454 qgrep_buf_t *current;
1455 current = head;
1456 @@ -132,11 +132,10 @@ void qgrep_buf_list_invalidate(qgrep_buf_t *head)
1457 typedef char *(*QGREP_STR_FUNC) (const char *, const char *);
1458
1459 /* Display a buffer, with an optionnal prefix. */
1460 -void qgrep_print_line(qgrep_buf_t *, const char *, const int, const char,
1461 - const regex_t*, const QGREP_STR_FUNC, const char*);
1462 -void qgrep_print_line(qgrep_buf_t *current, const char *label,
1463 - const int line_number, const char zig, const regex_t* preg,
1464 - const QGREP_STR_FUNC searchfunc, const char* searchstr)
1465 +static void
1466 +qgrep_print_line(qgrep_buf_t *current, const char *label,
1467 + const int line_number, const char zig, const regex_t* preg,
1468 + const QGREP_STR_FUNC searchfunc, const char* searchstr)
1469 {
1470 char *p = current->buf;
1471 /* Print line prefix, when in verbose mode */
1472 @@ -191,9 +190,9 @@ void qgrep_print_line(qgrep_buf_t *current, const char *label,
1473 qgrep_print_line(buf, label, lineno, ':', NULL, searchfunc, searchstr)
1474
1475 /* Display a leading context (valid lines of the buffers list, but the matching one). */
1476 -void qgrep_print_before_context(qgrep_buf_t *, const char, const char *, const int);
1477 -void qgrep_print_before_context(qgrep_buf_t *current, const char num_lines_before,
1478 - const char *label, const int match_line_number)
1479 +static void
1480 +qgrep_print_before_context(qgrep_buf_t *current, const char num_lines_before,
1481 + const char *label, const int match_line_number)
1482 {
1483 int line_number;
1484 line_number = match_line_number - num_lines_before;
1485 @@ -206,8 +205,8 @@ void qgrep_print_before_context(qgrep_buf_t *current, const char num_lines_befor
1486 }
1487
1488 /* Yield the path of one of the installed ebuilds (from VDB). */
1489 -char *get_next_installed_ebuild(char *, DIR *, struct dirent **, DIR **);
1490 -char *get_next_installed_ebuild(char *ebuild_path, DIR *vdb_dir, struct dirent **cat_dirent_pt, DIR **cat_dir_pt)
1491 +static char *
1492 +get_next_installed_ebuild(char *ebuild_path, DIR *vdb_dir, struct dirent **cat_dirent_pt, DIR **cat_dir_pt)
1493 {
1494 struct dirent *pkg_dirent = NULL;
1495 if (*cat_dirent_pt == NULL || *cat_dir_pt == NULL)
1496
1497 diff --git a/qlist.c b/qlist.c
1498 index 91ed45c..cda4ca7 100644
1499 --- a/qlist.c
1500 +++ b/qlist.c
1501 @@ -42,7 +42,8 @@ static const char * const qlist_opts_help[] = {
1502 };
1503 #define qlist_usage(ret) usage(ret, QLIST_FLAGS, qlist_long_opts, qlist_opts_help, NULL, lookup_applet_idx("qlist"))
1504
1505 -static char *grab_pkg_umap(q_vdb_pkg_ctx *pkg_ctx)
1506 +static char *
1507 +grab_pkg_umap(q_vdb_pkg_ctx *pkg_ctx)
1508 {
1509 static char umap[BUFSIZ];
1510 static char *use, *iuse;
1511 @@ -100,7 +101,8 @@ static char *grab_pkg_umap(q_vdb_pkg_ctx *pkg_ctx)
1512 return umap;
1513 }
1514
1515 -static const char *umapstr(char display, q_vdb_pkg_ctx *pkg_ctx)
1516 +static const char *
1517 +umapstr(char display, q_vdb_pkg_ctx *pkg_ctx)
1518 {
1519 static char buf[BUFSIZ];
1520 char *umap = NULL;
1521 @@ -117,7 +119,7 @@ static const char *umapstr(char display, q_vdb_pkg_ctx *pkg_ctx)
1522 return buf;
1523 }
1524
1525 -_q_static bool
1526 +static bool
1527 qlist_match(q_vdb_pkg_ctx *pkg_ctx, const char *name, depend_atom **name_atom, bool exact)
1528 {
1529 const char *catname = pkg_ctx->cat_ctx->name;
1530 @@ -272,7 +274,8 @@ struct qlist_opt_state {
1531 size_t buflen;
1532 };
1533
1534 -_q_static int qlist_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1535 +static int
1536 +qlist_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1537 {
1538 struct qlist_opt_state *state = priv;
1539 int i;
1540
1541 diff --git a/qlop.c b/qlop.c
1542 index 30e9f2f..f0c35b7 100644
1543 --- a/qlop.c
1544 +++ b/qlop.c
1545 @@ -47,7 +47,7 @@ static const char qlop_desc[] =
1546 #define QLOP_LIST 0x01
1547 #define QLOP_UNLIST 0x02
1548
1549 -_q_static void
1550 +static void
1551 print_seconds_for_earthlings(const unsigned long t)
1552 {
1553 unsigned dd, hh, mm, ss;
1554 @@ -62,7 +62,7 @@ print_seconds_for_earthlings(const unsigned long t)
1555 printf("%s%u%s second%s", GREEN, ss, NORM, (ss == 1 ? "" : "s"));
1556 }
1557
1558 -_q_static const char *
1559 +static const char *
1560 chop_ctime(time_t t)
1561 {
1562 static char ctime_out[50];
1563 @@ -72,7 +72,7 @@ chop_ctime(time_t t)
1564 return ctime_out;
1565 }
1566
1567 -_q_static unsigned long
1568 +static unsigned long
1569 show_merge_times(char *package, const char *logfile, int average, char human_readable,
1570 time_t start_time, time_t end_time)
1571 {
1572 @@ -227,7 +227,7 @@ show_merge_times(char *package, const char *logfile, int average, char human_rea
1573 return 0;
1574 }
1575
1576 -_q_static void
1577 +static void
1578 show_emerge_history(int listflag, array_t *atoms, const char *logfile,
1579 time_t start_time, time_t end_time)
1580 {
1581 @@ -327,7 +327,7 @@ New format:
1582 1431764460: === Sync completed for gentoo
1583 1431764493: *** terminating.
1584 */
1585 -_q_static void
1586 +static void
1587 show_sync_history(const char *logfile, time_t start_time, time_t end_time)
1588 {
1589 FILE *fp;
1590 @@ -376,7 +376,7 @@ show_sync_history(const char *logfile, time_t start_time, time_t end_time)
1591 fclose(fp);
1592 }
1593
1594 -_q_static void show_current_emerge(void);
1595 +static void show_current_emerge(void);
1596 #ifdef __linux__
1597 # include <asm/param.h>
1598 # include <elf.h>
1599 @@ -401,7 +401,8 @@ static void init_hz(void)
1600 hz = 100;
1601 }
1602
1603 -static char *root_readlink(const int pid)
1604 +static char *
1605 +root_readlink(const int pid)
1606 {
1607 static char path[_Q_PATH_MAX];
1608 char buf[_Q_PATH_MAX];
1609 @@ -652,8 +653,8 @@ void show_current_emerge(void)
1610 }
1611 #endif
1612
1613 -_q_static
1614 -bool parse_date(const char *sdate, time_t *t)
1615 +static bool
1616 +parse_date(const char *sdate, time_t *t)
1617 {
1618 struct tm tm;
1619 const char *s;
1620
1621 diff --git a/qmerge.c b/qmerge.c
1622 index 4ef156b..2c92599 100644
1623 --- a/qmerge.c
1624 +++ b/qmerge.c
1625 @@ -98,13 +98,14 @@ struct llist_char_t {
1626
1627 typedef struct llist_char_t llist_char;
1628
1629 -_q_static void pkg_fetch(int, const depend_atom *, const struct pkg_t *);
1630 -_q_static void pkg_merge(int, const depend_atom *, const struct pkg_t *);
1631 -_q_static int pkg_unmerge(q_vdb_pkg_ctx *, queue *);
1632 -_q_static struct pkg_t *grab_binpkg_info(const char *);
1633 -_q_static char *find_binpkg(const char *);
1634 -
1635 -_q_static void fetch(const char *destdir, const char *src)
1636 +static void pkg_fetch(int, const depend_atom *, const struct pkg_t *);
1637 +static void pkg_merge(int, const depend_atom *, const struct pkg_t *);
1638 +static int pkg_unmerge(q_vdb_pkg_ctx *, queue *);
1639 +static struct pkg_t *grab_binpkg_info(const char *);
1640 +static char *find_binpkg(const char *);
1641 +
1642 +static void
1643 +fetch(const char *destdir, const char *src)
1644 {
1645 if (!binhost[0])
1646 return;
1647 @@ -166,7 +167,8 @@ _q_static void fetch(const char *destdir, const char *src)
1648 fflush(stderr);
1649 }
1650
1651 -_q_static void qmerge_initialize(void)
1652 +static void
1653 +qmerge_initialize(void)
1654 {
1655 if (strlen(BUSYBOX))
1656 if (access(BUSYBOX, X_OK) != 0)
1657 @@ -205,13 +207,15 @@ struct qmerge_bv_state {
1658 char *retbuf;
1659 };
1660
1661 -_q_static int qmerge_filter_cat(q_vdb_cat_ctx *cat_ctx, void *priv)
1662 +static int
1663 +qmerge_filter_cat(q_vdb_cat_ctx *cat_ctx, void *priv)
1664 {
1665 struct qmerge_bv_state *state = priv;
1666 return !state->catname || strcmp(cat_ctx->name, state->catname) == 0;
1667 }
1668
1669 -_q_static int qmerge_best_version_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1670 +static int
1671 +qmerge_best_version_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1672 {
1673 struct qmerge_bv_state *state = priv;
1674 if (qlist_match(pkg_ctx, state->buf, NULL, true))
1675 @@ -220,7 +224,8 @@ _q_static int qmerge_best_version_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1676 return 0;
1677 }
1678
1679 -_q_static char *best_version(const char *catname, const char *pkgname)
1680 +static char *
1681 +best_version(const char *catname, const char *pkgname)
1682 {
1683 static int vdb_check = 1;
1684 static char retbuf[4096];
1685 @@ -255,7 +260,7 @@ _q_static char *best_version(const char *catname, const char *pkgname)
1686 return retbuf;
1687 }
1688
1689 -_q_static int
1690 +static int
1691 config_protected(const char *buf, int cp_argc, char **cp_argv,
1692 int cpm_argc, char **cpm_argv)
1693 {
1694 @@ -281,7 +286,8 @@ config_protected(const char *buf, int cp_argc, char **cp_argv,
1695 return 0;
1696 }
1697
1698 -_q_static void crossmount_rm(const char *fname, const struct stat st)
1699 +static void
1700 +crossmount_rm(const char *fname, const struct stat st)
1701 {
1702 struct stat lst;
1703
1704 @@ -297,8 +303,8 @@ _q_static void crossmount_rm(const char *fname, const struct stat st)
1705 rm_rf(fname);
1706 }
1707
1708 -void install_mask_pwd(int iargc, char **iargv, const struct stat st);
1709 -void install_mask_pwd(int iargc, char **iargv, const struct stat st)
1710 +static void
1711 +install_mask_pwd(int iargc, char **iargv, const struct stat st)
1712 {
1713 char buf[1024];
1714 int i;
1715 @@ -329,7 +335,7 @@ void install_mask_pwd(int iargc, char **iargv, const struct stat st)
1716 }
1717 }
1718
1719 -_q_static char *
1720 +static char *
1721 atom2str(const depend_atom *atom, char *buf, size_t size)
1722 {
1723 if (atom->PR_int)
1724 @@ -339,7 +345,7 @@ atom2str(const depend_atom *atom, char *buf, size_t size)
1725 return buf;
1726 }
1727
1728 -_q_static char
1729 +static char
1730 qprint_tree_node(int level, const depend_atom *atom, const struct pkg_t *pkg)
1731 {
1732 char buf[1024];
1733 @@ -407,7 +413,7 @@ qprint_tree_node(int level, const depend_atom *atom, const struct pkg_t *pkg)
1734 return c;
1735 }
1736
1737 -_q_static void
1738 +static void
1739 pkg_run_func_at(int dirfd, const char *vdb_path, const char *phases, const char *func, const char *D, const char *T)
1740 {
1741 const char *phase;
1742 @@ -481,7 +487,7 @@ pkg_run_func_at(int dirfd, const char *vdb_path, const char *phases, const char
1743 #define pkg_run_func(...) pkg_run_func_at(AT_FDCWD, __VA_ARGS__)
1744
1745 /* Copy one tree (the single package) to another tree (ROOT) */
1746 -_q_static int
1747 +static int
1748 merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst,
1749 FILE *contents, queue **objs, char **cpathp, int iargc, char **iargv,
1750 int cp_argc, char **cp_argv, int cpm_argc, char **cpm_argv)
1751 @@ -718,7 +724,7 @@ merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst,
1752 }
1753
1754 /* Copy one tree (the single package) to another tree (ROOT) */
1755 -_q_static int
1756 +static int
1757 merge_tree(const char *src, const char *dst, FILE *contents,
1758 queue **objs, int iargc, char **iargv)
1759 {
1760 @@ -746,7 +752,7 @@ merge_tree(const char *src, const char *dst, FILE *contents,
1761 }
1762
1763 /* oh shit getting into pkg mgt here. FIXME: write a real dep resolver. */
1764 -_q_static void
1765 +static void
1766 pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg)
1767 {
1768 queue *objs;
1769 @@ -1024,7 +1030,7 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg)
1770 q_vdb_close(vdb_ctx);
1771 }
1772
1773 -_q_static int
1774 +static int
1775 pkg_unmerge(q_vdb_pkg_ctx *pkg_ctx, queue *keep)
1776 {
1777 q_vdb_cat_ctx *cat_ctx = pkg_ctx->cat_ctx;
1778 @@ -1207,7 +1213,8 @@ pkg_unmerge(q_vdb_pkg_ctx *pkg_ctx, queue *keep)
1779 return ret;
1780 }
1781
1782 -_q_static int unlink_empty(const char *buf)
1783 +static int
1784 +unlink_empty(const char *buf)
1785 {
1786 struct stat st;
1787 if (stat(buf, &st) != -1)
1788 @@ -1216,7 +1223,7 @@ _q_static int unlink_empty(const char *buf)
1789 return -1;
1790 }
1791
1792 -_q_static int
1793 +static int
1794 pkg_verify_checksums(char *fname, const struct pkg_t *pkg, const depend_atom *atom,
1795 int strict, int display)
1796 {
1797 @@ -1260,7 +1267,7 @@ pkg_verify_checksums(char *fname, const struct pkg_t *pkg, const depend_atom *at
1798 return ret;
1799 }
1800
1801 -_q_static void
1802 +static void
1803 pkg_fetch(int level, const depend_atom *atom, const struct pkg_t *pkg)
1804 {
1805 char buf[_Q_PATH_MAX], str[_Q_PATH_MAX];
1806 @@ -1330,7 +1337,7 @@ pkg_fetch(int level, const depend_atom *atom, const struct pkg_t *pkg)
1807 }
1808 }
1809
1810 -_q_static void
1811 +static void
1812 print_Pkg(int full, const depend_atom *atom, const struct pkg_t *pkg)
1813 {
1814 char *p = NULL;
1815 @@ -1380,7 +1387,7 @@ print_Pkg(int full, const depend_atom *atom, const struct pkg_t *pkg)
1816 }
1817 }
1818
1819 -_q_static int
1820 +static int
1821 qmerge_unmerge_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1822 {
1823 queue *todo = priv;
1824 @@ -1394,13 +1401,13 @@ qmerge_unmerge_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1825 return 0;
1826 }
1827
1828 -_q_static int
1829 +static int
1830 unmerge_packages(queue *todo)
1831 {
1832 return q_vdb_foreach_pkg(qmerge_unmerge_cb, todo, NULL);
1833 }
1834
1835 -_q_static FILE *
1836 +static FILE *
1837 open_binpkg_index(void)
1838 {
1839 FILE *fp;
1840 @@ -1451,7 +1458,7 @@ open_binpkg_index(void)
1841 return fp;
1842 }
1843
1844 -_q_static struct pkg_t *
1845 +static struct pkg_t *
1846 grab_binpkg_info(const char *name)
1847 {
1848 FILE *fp;
1849 @@ -1553,7 +1560,7 @@ grab_binpkg_info(const char *name)
1850 return rpkg;
1851 }
1852
1853 -_q_static char *
1854 +static char *
1855 find_binpkg(const char *name)
1856 {
1857 FILE *fp;
1858 @@ -1634,7 +1641,7 @@ find_binpkg(const char *name)
1859 return best_match;
1860 }
1861
1862 -_q_static int
1863 +static int
1864 parse_packages(queue *todo)
1865 {
1866 FILE *fp;
1867 @@ -1766,7 +1773,7 @@ parse_packages(queue *todo)
1868 return EXIT_SUCCESS;
1869 }
1870
1871 -_q_static queue *
1872 +static queue *
1873 qmerge_add_set_file(const char *dir, const char *file, queue *set)
1874 {
1875 FILE *fp;
1876 @@ -1796,7 +1803,7 @@ qmerge_add_set_file(const char *dir, const char *file, queue *set)
1877 return set;
1878 }
1879
1880 -_q_static void *
1881 +static void *
1882 qmerge_add_set_system(void *data, char *buf)
1883 {
1884 queue *set = data;
1885 @@ -1821,7 +1828,7 @@ qmerge_add_set_system(void *data, char *buf)
1886 /* XXX: note, this doesn't handle more complicated set files like
1887 * the portage .ini files in /usr/share/portage/sets/ */
1888 /* XXX: this code does not combine duplicate dependencies */
1889 -_q_static queue *
1890 +static queue *
1891 qmerge_add_set(char *buf, queue *set)
1892 {
1893 if (strcmp(buf, "world") == 0)
1894 @@ -1836,7 +1843,7 @@ qmerge_add_set(char *buf, queue *set)
1895 return add_set(buf, set);
1896 }
1897
1898 -_q_static int
1899 +static int
1900 qmerge_run(queue *todo)
1901 {
1902 if (uninstall)
1903
1904 diff --git a/qpkg.c b/qpkg.c
1905 index 1c18edc..c54d735 100644
1906 --- a/qpkg.c
1907 +++ b/qpkg.c
1908 @@ -30,15 +30,9 @@ extern char pretend;
1909 static char *qpkg_bindir = NULL;
1910 static int eclean = 0;
1911
1912 -/* global functions */
1913 -int filter_tbz2(const struct dirent *);
1914 -uint64_t qpkg_clean_dir(char *, queue *);
1915 -int qpkg_clean(char *);
1916 -const char *qpkg_get_bindir(void);
1917 -int qpkg_make(depend_atom *);
1918 -
1919 /* checks to make sure this is a .tbz2 file. used by scandir() */
1920 -int filter_tbz2(const struct dirent *dentry)
1921 +static int
1922 +filter_tbz2(const struct dirent *dentry)
1923 {
1924 if (dentry->d_name[0] == '.')
1925 return 0;
1926 @@ -48,7 +42,8 @@ int filter_tbz2(const struct dirent *dentry)
1927 }
1928
1929 /* process a single dir for cleaning. dir can be a $PKGDIR, $PKGDIR/All/, $PKGDIR/$CAT */
1930 -uint64_t qpkg_clean_dir(char *dirp, queue *vdb)
1931 +static uint64_t
1932 +qpkg_clean_dir(char *dirp, queue *vdb)
1933 {
1934 queue *ll;
1935 struct dirent **fnames;
1936 @@ -99,7 +94,8 @@ uint64_t qpkg_clean_dir(char *dirp, queue *vdb)
1937 }
1938
1939 /* figure out what dirs we want to process for cleaning and display results. */
1940 -int qpkg_clean(char *dirp)
1941 +static int
1942 +qpkg_clean(char *dirp)
1943 {
1944 FILE *fp;
1945 int i, count;
1946 @@ -178,7 +174,8 @@ int qpkg_clean(char *dirp)
1947 return 0;
1948 }
1949
1950 -const char *qpkg_get_bindir(void)
1951 +static const char *
1952 +qpkg_get_bindir(void)
1953 {
1954 if (qpkg_bindir != NULL)
1955 return qpkg_bindir;
1956 @@ -191,8 +188,8 @@ const char *qpkg_get_bindir(void)
1957 return qpkg_bindir;
1958 }
1959
1960 -int check_pkg_install_mask(char *name);
1961 -int check_pkg_install_mask(char *name)
1962 +static int
1963 +check_pkg_install_mask(char *name)
1964 {
1965 int i, iargc, ret;
1966 char **iargv;
1967 @@ -214,7 +211,8 @@ int check_pkg_install_mask(char *name)
1968 return ret;
1969 }
1970
1971 -int qpkg_make(depend_atom *atom)
1972 +static int
1973 +qpkg_make(depend_atom *atom)
1974 {
1975 FILE *fp, *out;
1976 char tmpdir[BUFSIZE], filelist[BUFSIZE], xpak[BUFSIZE], tbz2[BUFSIZE];
1977
1978 diff --git a/qsize.c b/qsize.c
1979 index 376a772..b92f533 100644
1980 --- a/qsize.c
1981 +++ b/qsize.c
1982 @@ -49,7 +49,8 @@ struct qsize_opt_state {
1983 uint64_t num_all_bytes;
1984 };
1985
1986 -_q_static int qsize_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1987 +static int
1988 +qsize_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
1989 {
1990 struct qsize_opt_state *state = priv;
1991 const char *catname = pkg_ctx->cat_ctx->name;
1992
1993 diff --git a/qtbz2.c b/qtbz2.c
1994 index 6e6fff6..723ad27 100644
1995 --- a/qtbz2.c
1996 +++ b/qtbz2.c
1997 @@ -49,8 +49,8 @@ static const char * const qtbz2_opts_help[] = {
1998
1999 static char tbz2_stdout = 0;
2000
2001 -unsigned char *tbz2_encode_int(int enc);
2002 -unsigned char *tbz2_encode_int(int enc)
2003 +static unsigned char *
2004 +tbz2_encode_int(int enc)
2005 {
2006 static unsigned char ret[4];
2007 ret[0] = (enc & 0xff000000) >> 24;
2008 @@ -59,8 +59,8 @@ unsigned char *tbz2_encode_int(int enc)
2009 ret[3] = (enc & 0x000000ff);
2010 return ret;
2011 }
2012 -int tbz2_decode_int(unsigned char *buf);
2013 -int tbz2_decode_int(unsigned char *buf)
2014 +static int
2015 +tbz2_decode_int(unsigned char *buf)
2016 {
2017 int ret;
2018 ret = 0;
2019 @@ -71,8 +71,8 @@ int tbz2_decode_int(unsigned char *buf)
2020 return ret;
2021 }
2022
2023 -void _tbz2_copy_file(FILE *src, FILE *dst);
2024 -void _tbz2_copy_file(FILE *src, FILE *dst)
2025 +static void
2026 +_tbz2_copy_file(FILE *src, FILE *dst)
2027 {
2028 int count = 1;
2029 unsigned char buffer[BUFSIZE*32];
2030
2031 diff --git a/tests/tests.h b/tests/tests.h
2032 index cf96cf2..38838f8 100644
2033 --- a/tests/tests.h
2034 +++ b/tests/tests.h
2035 @@ -19,6 +19,5 @@
2036 } while (0)
2037 #define err(...) errf(__VA_ARGS__)
2038 #define errp(...) errf(__VA_ARGS__)
2039 -#define _q_static static
2040
2041 #endif