* [gentoo-commits] proj/portage-utils:master commit in: /, tests/, libq/
@ 2016-12-29 2:25 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2016-12-29 2:25 UTC (permalink / raw
To: gentoo-commits
commit: 572b19d78b29f82554fc31fe814de29742f0874c
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 28 23:12:37 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Dec 28 23:12:37 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=572b19d7
drop _q_static and standardize func prototypes a bit
libq/atom_compare.c | 12 +++--
libq/atom_explode.c | 14 +++---
libq/colors.c | 4 +-
libq/human_readable.c | 4 +-
libq/profile.c | 4 +-
libq/safe_io.c | 4 +-
libq/scandirat.c | 6 ++-
libq/vdb.c | 43 +++++++++++------
libq/vdb_get_next_dir.c | 3 +-
libq/virtuals.c | 16 ++++---
libq/xchdir.c | 4 +-
libq/xmkdir.c | 18 +++++---
main.c | 120 ++++++++++++++++++++++++++++--------------------
main.h | 4 --
qatom.c | 4 +-
qcache.c | 78 +++++++++++++++----------------
qcheck.c | 6 ++-
qdepends.c | 52 +++++++++++----------
qfile.c | 6 +--
qglsa.c | 18 ++++----
qgrep.c | 35 +++++++-------
qlist.c | 11 +++--
qlop.c | 19 ++++----
qmerge.c | 79 ++++++++++++++++---------------
qpkg.c | 26 +++++------
qsize.c | 3 +-
qtbz2.c | 12 ++---
tests/tests.h | 1 -
28 files changed, 334 insertions(+), 272 deletions(-)
diff --git a/libq/atom_compare.c b/libq/atom_compare.c
index dbea5b3..b69b809 100644
--- a/libq/atom_compare.c
+++ b/libq/atom_compare.c
@@ -6,10 +6,11 @@
* Copyright 2005-2014 Mike Frysinger - <vapier@gentoo.org>
*/
-const char * const booga[] = {"!!!", "!=", "==", ">", "<"};
+static const char * const booga[] = {"!!!", "!=", "==", ">", "<"};
enum { ERROR=0, NOT_EQUAL, EQUAL, NEWER, OLDER };
-static int _atom_compare_match(int ret, atom_operator op)
+static int
+_atom_compare_match(int ret, atom_operator op)
{
if (op == ATOM_OP_NONE)
return ret;
@@ -39,7 +40,8 @@ static int _atom_compare_match(int ret, atom_operator op)
* foo-1 <OLDER> foo-2
* foo-1 <NOT_EQUAL> bar-1
*/
-static int atom_compare(const depend_atom *a1, const depend_atom *a2)
+static int
+atom_compare(const depend_atom *a1, const depend_atom *a2)
{
/* sanity check that at most one has operators */
if (a1->pfx_op != ATOM_OP_NONE || a1->sfx_op != ATOM_OP_NONE) {
@@ -189,8 +191,8 @@ static int atom_compare(const depend_atom *a1, const depend_atom *a2)
return _atom_compare_match(NEWER, pfx_op);
}
-int atom_compare_str(const char * const s1, const char * const s2);
-int atom_compare_str(const char * const s1, const char * const s2)
+static int
+atom_compare_str(const char * const s1, const char * const s2)
{
depend_atom *a1, *a2;
int ret = ERROR;
diff --git a/libq/atom_explode.c b/libq/atom_explode.c
index 2855246..956ac49 100644
--- a/libq/atom_explode.c
+++ b/libq/atom_explode.c
@@ -40,8 +40,9 @@ typedef struct {
char *P, *SLOT, *REPO;
} depend_atom;
-void atom_print(const depend_atom *atom);
-void atom_print(const depend_atom *atom)
+#ifdef EBUG
+static void
+atom_print(const depend_atom *atom)
{
if (atom->CATEGORY)
printf("%s/", atom->CATEGORY);
@@ -53,14 +54,15 @@ void atom_print(const depend_atom *atom)
if (atom->REPO)
printf("::%s", atom->REPO);
}
+#endif
#ifdef _USE_CACHE
static depend_atom *_atom_cache = NULL;
static size_t _atom_cache_len = 0;
#endif
-depend_atom *atom_explode(const char *atom);
-depend_atom *atom_explode(const char *atom)
+static depend_atom *
+atom_explode(const char *atom)
{
depend_atom *ret;
char *ptr;
@@ -245,8 +247,8 @@ depend_atom *atom_explode(const char *atom)
return ret;
}
-void atom_implode(depend_atom *atom);
-void atom_implode(depend_atom *atom)
+static void
+atom_implode(depend_atom *atom)
{
if (!atom)
errf("Atom is empty !");
diff --git a/libq/colors.c b/libq/colors.c
index 6ddcdda..f90be0d 100644
--- a/libq/colors.c
+++ b/libq/colors.c
@@ -45,8 +45,8 @@ static cpairtype color_pairs[] = {
{"eol", COLOR("00", "00") },
};
-void color_remap(void);
-void color_remap(void)
+static void
+color_remap(void)
{
FILE *fp;
unsigned int i;
diff --git a/libq/human_readable.c b/libq/human_readable.c
index 0bb044a..931a994 100644
--- a/libq/human_readable.c
+++ b/libq/human_readable.c
@@ -24,14 +24,14 @@
#include <stdio.h>
-const char *make_human_readable_str(unsigned long long,unsigned long,unsigned long);
enum {
KILOBYTE = 1024,
MEGABYTE = (KILOBYTE*1024),
GIGABYTE = (MEGABYTE*1024)
};
-const char* make_human_readable_str(unsigned long long val,
+static const char *
+make_human_readable_str(unsigned long long val,
unsigned long block_size, unsigned long display_unit)
{
static const char unit_chars[] = {
diff --git a/libq/profile.c b/libq/profile.c
index 66e5caf..c954ba6 100644
--- a/libq/profile.c
+++ b/libq/profile.c
@@ -1,6 +1,6 @@
typedef void *(q_profile_callback_t)(void *, char *);
-_q_static void *
+static void *
q_profile_walk_at(int dir_fd, const char *dir, const char *file,
q_profile_callback_t callback, void *data)
{
@@ -69,7 +69,7 @@ q_profile_walk_at(int dir_fd, const char *dir, const char *file,
return data;
}
-_q_static void *
+static void *
q_profile_walk(const char *file, q_profile_callback_t callback, void *data)
{
/* Walk the profiles and read the file in question */
diff --git a/libq/safe_io.c b/libq/safe_io.c
index 059bcac..e5b958b 100644
--- a/libq/safe_io.c
+++ b/libq/safe_io.c
@@ -7,8 +7,8 @@
#include <stdio.h>
-size_t safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-size_t safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
+static size_t
+safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t ret = 0, this_ret;
diff --git a/libq/scandirat.c b/libq/scandirat.c
index 65d1012..f0b3201 100644
--- a/libq/scandirat.c
+++ b/libq/scandirat.c
@@ -20,7 +20,8 @@
# define reclen(de) (sizeof(*(de)) + strlen((de)->d_name))
#endif
-static int scandirat(int dir_fd, const char *dir, struct dirent ***dirlist,
+static int
+scandirat(int dir_fd, const char *dir, struct dirent ***dirlist,
int (*filter)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **))
{
@@ -59,7 +60,8 @@ static int scandirat(int dir_fd, const char *dir, struct dirent ***dirlist,
#endif
-_q_static void scandir_free(struct dirent **de, int cnt)
+static void
+scandir_free(struct dirent **de, int cnt)
{
if (cnt <= 0)
return;
diff --git a/libq/vdb.c b/libq/vdb.c
index 4b7d911..d42cdac 100644
--- a/libq/vdb.c
+++ b/libq/vdb.c
@@ -15,7 +15,8 @@ typedef struct {
DIR *dir;
} q_vdb_ctx;
-_q_static q_vdb_ctx *q_vdb_open(/*const char *sroot, const char *svdb*/void)
+static q_vdb_ctx *
+q_vdb_open(/*const char *sroot, const char *svdb*/void)
{
q_vdb_ctx *ctx = xmalloc(sizeof(*ctx));
const char *sroot = NULL;
@@ -57,7 +58,8 @@ _q_static q_vdb_ctx *q_vdb_open(/*const char *sroot, const char *svdb*/void)
return NULL;
}
-_q_static void q_vdb_close(q_vdb_ctx *ctx)
+static void
+q_vdb_close(q_vdb_ctx *ctx)
{
closedir(ctx->dir);
/* closedir() above does this for us: */
@@ -77,7 +79,8 @@ typedef struct {
const q_vdb_ctx *ctx;
} q_vdb_cat_ctx;
-_q_static int q_vdb_filter_cat(const struct dirent *de)
+static int
+q_vdb_filter_cat(const struct dirent *de)
{
int i;
@@ -108,7 +111,8 @@ _q_static int q_vdb_filter_cat(const struct dirent *de)
return i;
}
-_q_static q_vdb_cat_ctx *q_vdb_open_cat(q_vdb_ctx *ctx, const char *name)
+static q_vdb_cat_ctx *
+q_vdb_open_cat(q_vdb_ctx *ctx, const char *name)
{
q_vdb_cat_ctx *cat_ctx;
int fd;
@@ -133,7 +137,8 @@ _q_static q_vdb_cat_ctx *q_vdb_open_cat(q_vdb_ctx *ctx, const char *name)
return cat_ctx;
}
-_q_static q_vdb_cat_ctx *q_vdb_next_cat(q_vdb_ctx *ctx)
+static q_vdb_cat_ctx *
+q_vdb_next_cat(q_vdb_ctx *ctx)
{
/* search for a category directory */
q_vdb_cat_ctx *cat_ctx;
@@ -156,7 +161,8 @@ _q_static q_vdb_cat_ctx *q_vdb_next_cat(q_vdb_ctx *ctx)
return cat_ctx;
}
-_q_static void q_vdb_close_cat(q_vdb_cat_ctx *cat_ctx)
+static void
+q_vdb_close_cat(q_vdb_cat_ctx *cat_ctx)
{
closedir(cat_ctx->dir);
/* closedir() above does this for us: */
@@ -176,7 +182,8 @@ typedef struct {
q_vdb_cat_ctx *cat_ctx;
} q_vdb_pkg_ctx;
-_q_static int q_vdb_filter_pkg(const struct dirent *de)
+static int
+q_vdb_filter_pkg(const struct dirent *de)
{
#ifdef DT_UNKNOWN
if (de->d_type != DT_UNKNOWN &&
@@ -191,7 +198,8 @@ _q_static int q_vdb_filter_pkg(const struct dirent *de)
return 1;
}
-_q_static q_vdb_pkg_ctx *q_vdb_open_pkg(q_vdb_cat_ctx *cat_ctx, const char *name)
+static q_vdb_pkg_ctx *
+q_vdb_open_pkg(q_vdb_cat_ctx *cat_ctx, const char *name)
{
q_vdb_pkg_ctx *pkg_ctx = xmalloc(sizeof(*pkg_ctx));
pkg_ctx->name = name;
@@ -202,7 +210,8 @@ _q_static q_vdb_pkg_ctx *q_vdb_open_pkg(q_vdb_cat_ctx *cat_ctx, const char *name
return pkg_ctx;
}
-_q_static q_vdb_pkg_ctx *q_vdb_next_pkg(q_vdb_cat_ctx *cat_ctx)
+static q_vdb_pkg_ctx *
+q_vdb_next_pkg(q_vdb_cat_ctx *cat_ctx)
{
q_vdb_pkg_ctx *pkg_ctx;
const struct dirent *de;
@@ -224,7 +233,7 @@ _q_static q_vdb_pkg_ctx *q_vdb_next_pkg(q_vdb_cat_ctx *cat_ctx)
return pkg_ctx;
}
-_q_static int
+static int
q_vdb_pkg_openat(q_vdb_pkg_ctx *pkg_ctx, const char *file, int flags, mode_t mode)
{
if (pkg_ctx->fd == -1) {
@@ -236,7 +245,8 @@ q_vdb_pkg_openat(q_vdb_pkg_ctx *pkg_ctx, const char *file, int flags, mode_t mod
return openat(pkg_ctx->fd, file, flags|O_CLOEXEC, mode);
}
-_q_static FILE *q_vdb_pkg_fopenat(q_vdb_pkg_ctx *pkg_ctx, const char *file,
+static FILE *
+q_vdb_pkg_fopenat(q_vdb_pkg_ctx *pkg_ctx, const char *file,
int flags, mode_t mode, const char *fmode)
{
FILE *fp;
@@ -255,7 +265,7 @@ _q_static FILE *q_vdb_pkg_fopenat(q_vdb_pkg_ctx *pkg_ctx, const char *file,
#define q_vdb_pkg_fopenat_ro(pkg_ctx, file) q_vdb_pkg_fopenat(pkg_ctx, file, O_RDONLY, 0, "r")
#define q_vdb_pkg_fopenat_rw(pkg_ctx, file) q_vdb_pkg_fopenat(pkg_ctx, file, O_RDWR|O_CREAT|O_TRUNC, 0644, "w")
-_q_static bool
+static bool
q_vdb_pkg_eat(q_vdb_pkg_ctx *pkg_ctx, const char *file, char **bufptr, size_t *buflen)
{
int fd = q_vdb_pkg_openat(pkg_ctx, file, O_RDONLY, 0);
@@ -266,7 +276,8 @@ q_vdb_pkg_eat(q_vdb_pkg_ctx *pkg_ctx, const char *file, char **bufptr, size_t *b
return ret;
}
-_q_static void q_vdb_close_pkg(q_vdb_pkg_ctx *pkg_ctx)
+static void
+q_vdb_close_pkg(q_vdb_pkg_ctx *pkg_ctx)
{
if (pkg_ctx->fd != -1)
close(pkg_ctx->fd);
@@ -282,7 +293,8 @@ _q_static void q_vdb_close_pkg(q_vdb_pkg_ctx *pkg_ctx)
typedef int (q_vdb_pkg_cb)(q_vdb_pkg_ctx *, void *priv);
typedef int (q_vdb_cat_filter)(q_vdb_cat_ctx *, void *priv);
-_q_static int q_vdb_foreach_pkg(q_vdb_pkg_cb callback, void *priv, q_vdb_cat_filter filter)
+static int
+q_vdb_foreach_pkg(q_vdb_pkg_cb callback, void *priv, q_vdb_cat_filter filter)
{
q_vdb_ctx *ctx;
q_vdb_cat_ctx *cat_ctx;
@@ -306,7 +318,8 @@ _q_static int q_vdb_foreach_pkg(q_vdb_pkg_cb callback, void *priv, q_vdb_cat_fil
return ret;
}
-_q_static int q_vdb_foreach_pkg_sorted(q_vdb_pkg_cb callback, void *priv)
+static int
+q_vdb_foreach_pkg_sorted(q_vdb_pkg_cb callback, void *priv)
{
q_vdb_ctx *ctx;
q_vdb_cat_ctx *cat_ctx;
diff --git a/libq/vdb_get_next_dir.c b/libq/vdb_get_next_dir.c
index b264e7c..c47252b 100644
--- a/libq/vdb_get_next_dir.c
+++ b/libq/vdb_get_next_dir.c
@@ -1,4 +1,5 @@
-_q_static struct dirent *q_vdb_get_next_dir(DIR *dir)
+static struct dirent *
+q_vdb_get_next_dir(DIR *dir)
{
/* search for a category directory */
struct dirent *ret;
diff --git a/libq/virtuals.c b/libq/virtuals.c
index 1818281..2112965 100644
--- a/libq/virtuals.c
+++ b/libq/virtuals.c
@@ -19,7 +19,7 @@ struct queue_t {
typedef struct queue_t queue;
-_q_static queue *
+static queue *
append_set(queue *q, queue *ll)
{
queue *z;
@@ -36,7 +36,7 @@ append_set(queue *q, queue *ll)
}
/* add a set to a cache */
-_q_static queue *
+static queue *
add_set(const char *name, queue *q)
{
queue *ll = xmalloc(sizeof(*ll));
@@ -47,7 +47,7 @@ add_set(const char *name, queue *q)
}
/* Performance here is terrible. Should use a hash at some point. */
-_q_static queue *
+static queue *
add_set_unique(const char *name, queue *q, bool *ok)
{
queue *ll = q;
@@ -63,7 +63,7 @@ add_set_unique(const char *name, queue *q, bool *ok)
}
/* remove a set from a cache. matches ->name and frees name,item */
-_q_static queue *
+static queue *
del_set(char *s, queue *q, int *ok)
{
queue *ll, *list, *old;
@@ -96,7 +96,7 @@ del_set(char *s, queue *q, int *ok)
}
/* clear out a list */
-_q_static void
+static void
free_sets(queue *list)
{
queue *ll, *q;
@@ -109,10 +109,12 @@ free_sets(queue *list)
}
}
-void print_sets(const queue *list);
-void print_sets(const queue *list)
+#ifdef EBUG
+static void
+print_sets(const queue *list)
{
const queue *ll;
for (ll = list; ll != NULL; ll = ll->next)
puts(ll->name);
}
+#endif
diff --git a/libq/xchdir.c b/libq/xchdir.c
index 242b04a..6d93305 100644
--- a/libq/xchdir.c
+++ b/libq/xchdir.c
@@ -7,8 +7,8 @@
#include <unistd.h>
-void xchdir(const char *path);
-void xchdir(const char *path)
+static void
+xchdir(const char *path)
{
if (unlikely(chdir(path) != 0))
errp("chdir(%s) failed", path);
diff --git a/libq/xmkdir.c b/libq/xmkdir.c
index b47d44c..265cb5b 100644
--- a/libq/xmkdir.c
+++ b/libq/xmkdir.c
@@ -1,5 +1,6 @@
/* Emulate `mkdir -p -m MODE PATH` */
-static int mkdir_p_at(int dfd, const char *path, mode_t mode)
+static int
+mkdir_p_at(int dfd, const char *path, mode_t mode)
{
char *_p, *p, *s;
@@ -35,13 +36,15 @@ static int mkdir_p_at(int dfd, const char *path, mode_t mode)
return 0;
}
-static int mkdir_p(const char *path, mode_t mode)
+static int
+mkdir_p(const char *path, mode_t mode)
{
return mkdir_p_at(AT_FDCWD, path, mode);
}
/* Emulate `rm -rf PATH` */
-_q_static int rm_rf_at(int dfd, const char *path)
+static int
+rm_rf_at(int dfd, const char *path)
{
int subdfd;
DIR *dir;
@@ -75,7 +78,8 @@ _q_static int rm_rf_at(int dfd, const char *path)
return 0;
}
-_q_static int rm_rf(const char *path)
+static int
+rm_rf(const char *path)
{
rm_rf_at(AT_FDCWD, path);
@@ -91,7 +95,8 @@ _q_static int rm_rf(const char *path)
return -1;
}
-_q_static int rmdir_r_at(int dfd, const char *path)
+static int
+rmdir_r_at(int dfd, const char *path)
{
size_t len;
char *p, *e;
@@ -113,7 +118,8 @@ _q_static int rmdir_r_at(int dfd, const char *path)
}
/*
-_q_static int rmdir_r(const char *path)
+static int
+rmdir_r(const char *path)
{
return rmdir_r_at(AT_FDCWD, path);
}
diff --git a/main.c b/main.c
index 9921363..33db01a 100644
--- a/main.c
+++ b/main.c
@@ -13,16 +13,11 @@
static bool eat_file(const char *, char **, size_t *);
static bool eat_file_fd(int, char **, size_t *);
static bool eat_file_at(int, const char *, char **, size_t *);
-int rematch(const char *, const char *, int);
+static int rematch(const char *, const char *, int);
static char *rmspace(char *);
static char *rmspace_len(char *, size_t);
-void initialize_portage_env(void);
-void initialize_ebuild_flat(void);
-void reinitialize_ebuild_flat(void);
-void reinitialize_as_needed(void);
-void cleanup(void);
-int lookup_applet_idx(const char *);
+static int lookup_applet_idx(const char *);
/* variables to control runtime behavior */
char *module_name = NULL;
@@ -60,8 +55,8 @@ static const char *argv0;
#ifdef EBUG
# include <sys/resource.h>
-void init_coredumps(void);
-void init_coredumps(void)
+static void
+init_coredumps(void)
{
struct rlimit rl;
rl.rlim_cur = RLIM_INFINITY;
@@ -75,8 +70,8 @@ void init_coredumps(void)
static DECLARE_ARRAY(overlays);
-_q_static
-void no_colors(void)
+static void
+no_colors(void)
{
/* echo $(awk '{print $4,"="}' libq/colors.c | grep ^* |cut -c 2-| grep ^[A-Z] |tr '\n' ' ') = \"\"\; */
BOLD = NORM = BLUE = DKBLUE = CYAN = GREEN = DKGREEN = MAGENTA = RED = YELLOW = BRYELLOW = WHITE = "";
@@ -114,8 +109,9 @@ void no_colors(void)
default: applet ## _usage(EXIT_FAILURE); break;
/* display usage and exit */
-static void usage(int status, const char *flags, struct option const opts[],
- const char * const help[], const char *desc, int blabber)
+static void
+usage(int status, const char *flags, struct option const opts[],
+ const char * const help[], const char *desc, int blabber)
{
const char opt_arg[] = "[arg]";
const char a_arg[] = "<arg>";
@@ -181,7 +177,8 @@ static void usage(int status, const char *flags, struct option const opts[],
exit(status);
}
-static void version_barf(void)
+static void
+version_barf(void)
{
#ifndef VERSION
# define VERSION "git"
@@ -195,7 +192,8 @@ static void version_barf(void)
exit(EXIT_SUCCESS);
}
-static bool eat_file_fd(int fd, char **bufptr, size_t *bufsize)
+static bool
+eat_file_fd(int fd, char **bufptr, size_t *bufsize)
{
bool ret = true;
struct stat s;
@@ -243,7 +241,8 @@ static bool eat_file_fd(int fd, char **bufptr, size_t *bufsize)
return ret;
}
-static bool eat_file_at(int dfd, const char *file, char **bufptr, size_t *bufsize)
+static bool
+eat_file_at(int dfd, const char *file, char **bufptr, size_t *bufsize)
{
bool ret;
int fd;
@@ -256,12 +255,14 @@ static bool eat_file_at(int dfd, const char *file, char **bufptr, size_t *bufsiz
return ret;
}
-static bool eat_file(const char *file, char **bufptr, size_t *bufsize)
+static bool
+eat_file(const char *file, char **bufptr, size_t *bufsize)
{
return eat_file_at(AT_FDCWD, file, bufptr, bufsize);
}
-static bool prompt(const char *p)
+static bool
+prompt(const char *p)
{
printf("%s? [Y/n] ", p);
fflush(stdout);
@@ -275,7 +276,8 @@ static bool prompt(const char *p)
}
}
-int rematch(const char *re, const char *match, int cflags)
+static int
+rematch(const char *re, const char *match, int cflags)
{
regex_t preg;
int ret;
@@ -292,8 +294,8 @@ int rematch(const char *re, const char *match, int cflags)
}
/* removes adjacent extraneous white space */
-static char *remove_extra_space(char *str);
-static char *remove_extra_space(char *str)
+static char *
+remove_extra_space(char *str)
{
char *p, c = ' ';
size_t len, pos = 0;
@@ -317,14 +319,16 @@ static char *remove_extra_space(char *str)
return str;
}
-static void freeargv(int argc, char **argv)
+static void
+freeargv(int argc, char **argv)
{
while (argc--)
free(argv[argc]);
free(argv);
}
-static void makeargv(const char *string, int *argc, char ***argv)
+static void
+makeargv(const char *string, int *argc, char ***argv)
{
int curc = 2;
char *q, *p, *str;
@@ -369,8 +373,8 @@ typedef struct {
long mtime;
} contents_entry;
-contents_entry *contents_parse_line(char *line);
-contents_entry *contents_parse_line(char *line)
+static contents_entry *
+contents_parse_line(char *line)
{
static contents_entry e;
char *p;
@@ -444,7 +448,8 @@ contents_entry *contents_parse_line(char *line)
}
/* Handle a single file in the repos.conf format. */
-static void read_one_repos_conf(const char *repos_conf)
+static void
+read_one_repos_conf(const char *repos_conf)
{
int nsec;
char *conf;
@@ -478,7 +483,8 @@ static void read_one_repos_conf(const char *repos_conf)
}
/* Handle a possible directory of files. */
-static void read_repos_conf(const char *configroot, const char *repos_conf)
+static void
+read_repos_conf(const char *configroot, const char *repos_conf)
{
char *top_conf, *sub_conf;
int i, count;
@@ -526,7 +532,8 @@ static void read_repos_conf(const char *configroot, const char *repos_conf)
free(top_conf);
}
-static void strincr_var(const char *name, const char *s, char **value, size_t *value_len)
+static void
+strincr_var(const char *name, const char *s, char **value, size_t *value_len)
{
size_t len;
char *buf, *p, *nv;
@@ -584,7 +591,8 @@ typedef struct {
const char *default_value;
} env_vars;
-_q_static env_vars *get_portage_env_var(env_vars *vars, const char *name)
+static env_vars *
+get_portage_env_var(env_vars *vars, const char *name)
{
size_t i;
@@ -595,7 +603,8 @@ _q_static env_vars *get_portage_env_var(env_vars *vars, const char *name)
return NULL;
}
-_q_static void set_portage_env_var(env_vars *var, const char *value)
+static void
+set_portage_env_var(env_vars *var, const char *value)
{
switch (var->type) {
case _Q_BOOL:
@@ -612,7 +621,8 @@ _q_static void set_portage_env_var(env_vars *var, const char *value)
}
/* Helper to read a portage env file (e.g. make.conf) */
-_q_static void read_portage_env_file(const char *configroot, const char *file, env_vars vars[])
+static void
+read_portage_env_file(const char *configroot, const char *file, env_vars vars[])
{
size_t i, buflen, line, configroot_len, file_len;
FILE *fp;
@@ -729,7 +739,8 @@ _q_static void read_portage_env_file(const char *configroot, const char *file, e
}
/* Helper to recursively read stacked make.defaults in profiles */
-static void read_portage_profile(const char *configroot, const char *profile, env_vars vars[])
+static void
+read_portage_profile(const char *configroot, const char *profile, env_vars vars[])
{
size_t configroot_len, profile_len, sub_len;
char *profile_file, *sub_file;
@@ -770,7 +781,8 @@ static void read_portage_profile(const char *configroot, const char *profile, en
free(profile_file);
}
-void initialize_portage_env(void)
+static void
+initialize_portage_env(void)
{
size_t i;
const char *s;
@@ -955,8 +967,8 @@ enum {
CACHE_METADATA_MD5 = 11,
};
-int filter_hidden(const struct dirent *dentry);
-int filter_hidden(const struct dirent *dentry)
+static int
+filter_hidden(const struct dirent *dentry)
{
if (dentry->d_name[0] == '.')
return 0;
@@ -1094,7 +1106,8 @@ ret:
return cache_file;
}
-void reinitialize_as_needed(void)
+static void
+reinitialize_as_needed(void)
{
size_t n;
const char *overlay, *ret = ret;
@@ -1140,12 +1153,12 @@ typedef struct {
char *_md5_;
} portage_cache;
-void cache_free(portage_cache *cache);
-portage_cache *cache_read_file_pms(const char *file);
-portage_cache *cache_read_file_md5(const char *file);
-portage_cache *cache_read_file(const char *file);
+static void cache_free(portage_cache *cache);
+static portage_cache *cache_read_file_pms(const char *file);
+static portage_cache *cache_read_file_md5(const char *file);
-portage_cache *cache_read_file(const char *file)
+static portage_cache *
+cache_read_file(const char *file)
{
if (portcachedir_type == CACHE_METADATA_MD5)
return(cache_read_file_md5(file));
@@ -1155,7 +1168,8 @@ portage_cache *cache_read_file(const char *file)
return NULL;
}
-portage_cache *cache_read_file_pms(const char *file)
+static portage_cache *
+cache_read_file_pms(const char *file)
{
struct stat s;
char *ptr;
@@ -1213,7 +1227,8 @@ err:
return NULL;
}
-portage_cache *cache_read_file_md5(const char *file)
+static portage_cache *
+cache_read_file_md5(const char *file)
{
struct stat s;
char *ptr, *endptr;
@@ -1311,8 +1326,9 @@ err:
return NULL;
}
-void cache_dump(portage_cache *cache);
-void cache_dump(portage_cache *cache)
+#ifdef EBUG
+static void
+cache_dump(portage_cache *cache)
{
if (!cache)
errf("Cache is empty !");
@@ -1339,8 +1355,10 @@ void cache_dump(portage_cache *cache)
printf("PV : %s\n", cache->atom->PV);
printf("PVR : %s\n", cache->atom->PVR);
}
+#endif
-void cache_free(portage_cache *cache)
+static void
+cache_free(portage_cache *cache)
{
if (!cache)
errf("Cache is empty !");
@@ -1348,13 +1366,14 @@ void cache_free(portage_cache *cache)
free(cache);
}
-char *atom_to_pvr(depend_atom *atom);
-char *atom_to_pvr(depend_atom *atom) {
+static char *
+atom_to_pvr(depend_atom *atom) {
return (atom->PR_int == 0 ? atom->P : atom->PVR );
}
/* TODO: Merge this into libq/vdb.c somehow. */
-_q_static queue *get_vdb_atoms(int fullcpv)
+static queue *
+get_vdb_atoms(int fullcpv)
{
q_vdb_ctx *ctx;
@@ -1421,7 +1440,8 @@ _q_static queue *get_vdb_atoms(int fullcpv)
return cpf;
}
-void cleanup(void)
+static void
+cleanup(void)
{
reinitialize_as_needed();
}
diff --git a/main.h b/main.h
index d3df8b1..9f28f80 100644
--- a/main.h
+++ b/main.h
@@ -6,10 +6,6 @@
* Copyright 2005-2014 Mike Frysinger - <vapier@gentoo.org>
*/
-#ifndef _q_static
-# define _q_static static
-#endif
-
/* make sure our buffers are as big as they can be */
#if PATH_MAX > _POSIX_PATH_MAX /* _Q_PATH_MAX */
# define _Q_PATH_MAX PATH_MAX
diff --git a/qatom.c b/qatom.c
index 8cdffb1..7f981c3 100644
--- a/qatom.c
+++ b/qatom.c
@@ -32,8 +32,8 @@ static const char * const qatom_opts_help[] = {
* pfx - the version qualifier if set (e.g. > < = !)
* sfx - the version qualifier if set (e.g. *)
*/
-_q_static
-void qatom_printf(const char *format, const depend_atom *atom, int pverbose)
+static void
+qatom_printf(const char *format, const depend_atom *atom, int pverbose)
{
char bracket;
const char *fmt, *p;
diff --git a/qcache.c b/qcache.c
index c5421c7..7cd100e 100644
--- a/qcache.c
+++ b/qcache.c
@@ -81,8 +81,8 @@ enum { none = 0, testing, stable, minus };
* OUT:
* int - one of the following enum { none = 0, testing, stable, minus };
*/
-_q_static
-int decode_status(char c)
+static int
+decode_status(char c)
{
switch (c) {
case '-': return minus;
@@ -101,8 +101,8 @@ int decode_status(char c)
* OUT:
* int pos - location of arch in archlist[]
*/
-_q_static
-int decode_arch(const char *arch)
+static int
+decode_arch(const char *arch)
{
queue *q = arches;
int a;
@@ -132,8 +132,8 @@ int decode_arch(const char *arch)
* char *category - current category of the current package
* int *keywords - an array of keywords that coincides with archlist
*/
-_q_static
-void print_keywords(const char *category, const char *ebuild, int *keywords)
+static void
+print_keywords(const char *category, const char *ebuild, int *keywords)
{
queue *arch = arches;
int a;
@@ -170,8 +170,8 @@ void print_keywords(const char *category, const char *ebuild, int *keywords)
* ERR:
* int rc - -1 is returned on error (if !s || !keywords)
*/
-_q_static
-int read_keywords(char *s, int *keywords)
+static int
+read_keywords(char *s, int *keywords)
{
char *arch, delim[2] = { ' ', '\0' };
size_t slen;
@@ -213,8 +213,8 @@ int read_keywords(char *s, int *keywords)
* ERR:
* NULL is returned when an error occurs.
*/
-_q_static
-portage_cache *qcache_read_cache_file(const char *filename)
+static portage_cache *
+qcache_read_cache_file(const char *filename)
{
struct stat s;
char *buf;
@@ -297,8 +297,8 @@ portage_cache *qcache_read_cache_file(const char *filename)
* IN:
* portage_cache *cache - the portage_cache to be free()'d
*/
-_q_static
-void qcache_free_data(portage_cache *cache)
+static void
+qcache_free_data(portage_cache *cache)
{
int i;
char **c;
@@ -331,8 +331,8 @@ void qcache_free_data(portage_cache *cache)
* 1 (OLDER)
* 0 (SAME)
*/
-_q_static
-int qcache_vercmp(const struct dirent **x, const struct dirent **y)
+static int
+qcache_vercmp(const struct dirent **x, const struct dirent **y)
{
switch (atom_compare_str((*x)->d_name, (*y)->d_name)) {
case NEWER: return -1;
@@ -356,8 +356,8 @@ int qcache_vercmp(const struct dirent **x, const struct dirent **y)
* OUT:
* int - 0 if filename begins with '.' or is "metadata.xml", otherwise 1
*/
-_q_static
-int qcache_file_select(const struct dirent *entry)
+static int
+qcache_file_select(const struct dirent *entry)
{
return !(entry->d_name[0] == '.' || (strcmp(entry->d_name, "metadata.xml") == 0) || (strstr(entry->d_name, ".cpickle") != 0));
}
@@ -372,8 +372,8 @@ int qcache_file_select(const struct dirent *entry)
* OUT:
* int - 1 if the filename ends in ".ebuild", otherwise 0
*/
-_q_static
-int qcache_ebuild_select(const struct dirent *entry)
+static int
+qcache_ebuild_select(const struct dirent *entry)
{
return ((strlen(entry->d_name) > 7) && !strcmp(entry->d_name+strlen(entry->d_name)-7, ".ebuild"));
}
@@ -382,7 +382,7 @@ int qcache_ebuild_select(const struct dirent *entry)
/* Traversal function */
/********************************************************************/
-_q_static void qcache_load_arches(const char *overlay);
+static void qcache_load_arches(const char *overlay);
/*
* int qcache_traverse(void (*func)(qcache_data*));
@@ -396,8 +396,8 @@ _q_static void qcache_load_arches(const char *overlay);
* ERR:
* exit or return -1 on failure.
*/
-_q_static
-int qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay)
+static int
+qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay)
{
qcache_data data = {
.overlay = overlay,
@@ -507,8 +507,8 @@ int qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay)
return 0;
}
-_q_static
-int qcache_traverse(void (*func)(qcache_data*))
+static int
+qcache_traverse(void (*func)(qcache_data*))
{
int ret;
size_t n;
@@ -532,8 +532,8 @@ int qcache_traverse(void (*func)(qcache_data*))
/* functors */
/********************************************************************/
-_q_static
-void qcache_imlate(qcache_data *data)
+static void
+qcache_imlate(qcache_data *data)
{
int *keywords;
int a;
@@ -569,8 +569,8 @@ void qcache_imlate(qcache_data *data)
free(keywords);
}
-_q_static
-void qcache_not(qcache_data *data)
+static void
+qcache_not(qcache_data *data)
{
int *keywords;
@@ -596,8 +596,8 @@ void qcache_not(qcache_data *data)
free(keywords);
}
-_q_static
-void qcache_all(qcache_data *data)
+static void
+qcache_all(qcache_data *data)
{
int *keywords;
@@ -622,8 +622,8 @@ void qcache_all(qcache_data *data)
free(keywords);
}
-_q_static
-void qcache_dropped(qcache_data *data)
+static void
+qcache_dropped(qcache_data *data)
{
static int possible = 0;
int *keywords, i;
@@ -668,8 +668,8 @@ void qcache_dropped(qcache_data *data)
free(keywords);
}
-_q_static
-void qcache_stats(qcache_data *data)
+static void
+qcache_stats(qcache_data *data)
{
static time_t runtime;
static queue *allcats;
@@ -820,8 +820,8 @@ void qcache_stats(qcache_data *data)
}
}
-_q_static
-void qcache_testing_only(qcache_data *data)
+static void
+qcache_testing_only(qcache_data *data)
{
static int possible = 0;
int *keywords;
@@ -863,8 +863,8 @@ void qcache_testing_only(qcache_data *data)
/* Misc functions */
/********************************************************************/
-_q_static
-void qcache_load_arches(const char *overlay)
+static void
+qcache_load_arches(const char *overlay)
{
FILE *fp;
char *filename, *s;
@@ -906,8 +906,8 @@ void qcache_load_arches(const char *overlay)
*
* Deallocate variables (archlist)
*/
-_q_static
-void qcache_free(void)
+static void
+qcache_free(void)
{
free_sets(arches);
}
diff --git a/qcheck.c b/qcheck.c
index 40968a6..26b820e 100644
--- a/qcheck.c
+++ b/qcheck.c
@@ -47,7 +47,8 @@ struct qcheck_opt_state {
bool undo_prelink;
};
-static int qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state)
+static int
+qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state)
{
int fd;
FILE *fp, *fpx;
@@ -305,7 +306,8 @@ static int qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_sta
return EXIT_SUCCESS;
}
-_q_static int qcheck_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
+static int
+qcheck_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
{
struct qcheck_opt_state *state = priv;
const char *catname = pkg_ctx->cat_ctx->name;
diff --git a/qdepends.c b/qdepends.c
index 3c90863..a614704 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -66,17 +66,15 @@ static const dep_node null_node = {
#else
# define dep_dump_tree(r) _dep_print_tree(stdout, r, 0)
#endif
-_q_static void _dep_print_tree(FILE *fp, const dep_node *root, size_t space);
-void dep_burn_tree(dep_node *root);
-char *dep_flatten_tree(const dep_node *root);
-_q_static void _dep_attach(dep_node *root, dep_node *attach_me, int type);
-_q_static void _dep_burn_node(dep_node *node);
-int qdepends_main_vdb(const char *depend_file, int argc, char **argv);
-int qdepends_vdb_deep(const char *depend_file, const char *query);
+static void _dep_print_tree(FILE *fp, const dep_node *root, size_t space);
+static void dep_burn_tree(dep_node *root);
+static char *dep_flatten_tree(const dep_node *root);
+static void _dep_attach(dep_node *root, dep_node *attach_me, int type);
+static void _dep_burn_node(dep_node *node);
#ifdef EBUG
-void print_word(const char *ptr, size_t num);
-void print_word(const char *ptr, size_t num)
+static void
+print_word(const char *ptr, size_t num)
{
while (num--)
printf("%c", *ptr++);
@@ -84,7 +82,7 @@ void print_word(const char *ptr, size_t num)
}
#endif
-_q_static dep_node *
+static dep_node *
_dep_grow_node(dep_type type, const char *info, size_t info_len)
{
dep_node *ret;
@@ -112,7 +110,8 @@ _dep_grow_node(dep_type type, const char *info, size_t info_len)
return ret;
}
-void _dep_burn_node(dep_node *node)
+static void
+_dep_burn_node(dep_node *node)
{
assert(node);
if (node->info_on_heap) free(node->info);
@@ -125,7 +124,8 @@ enum {
_DEP_CHILD = 2
};
-void _dep_attach(dep_node *root, dep_node *attach_me, int type)
+static void
+_dep_attach(dep_node *root, dep_node *attach_me, int type)
{
if (type == _DEP_NEIGH) {
if (!root->neighbor) {
@@ -142,7 +142,8 @@ void _dep_attach(dep_node *root, dep_node *attach_me, int type)
}
}
-_q_static dep_node *dep_grow_tree(const char *depend)
+static dep_node *
+dep_grow_tree(const char *depend)
{
bool saw_whitespace;
signed long paren_balanced;
@@ -160,8 +161,6 @@ _q_static dep_node *dep_grow_tree(const char *depend)
#define _maybe_consume_word(t) \
do { \
if (!word) break; \
- /*printf("Found word:%i ", curr_attach);*/ \
- /*print_word(word, ptr-word);*/ \
new_node = _dep_grow_node(t, word, ptr-word); \
if (!ret) \
ret = curr_node = new_node; \
@@ -269,7 +268,8 @@ error_out:
return NULL;
}
-_q_static void _dep_print_tree(FILE *fp, const dep_node *root, size_t space)
+static void
+_dep_print_tree(FILE *fp, const dep_node *root, size_t space)
{
size_t s;
@@ -306,7 +306,8 @@ _q_static void _dep_print_tree(FILE *fp, const dep_node *root, size_t space)
_dep_print_tree(fp, root->neighbor, space);
}
-_q_static bool dep_print_depend(FILE *fp, const char *depend)
+static bool
+dep_print_depend(FILE *fp, const char *depend)
{
dep_node *dep_tree;
@@ -326,7 +327,8 @@ _q_static bool dep_print_depend(FILE *fp, const char *depend)
return true;
}
-void dep_burn_tree(dep_node *root)
+static void
+dep_burn_tree(dep_node *root)
{
assert(root);
if (root->children) dep_burn_tree(root->children);
@@ -334,7 +336,8 @@ void dep_burn_tree(dep_node *root)
_dep_burn_node(root);
}
-_q_static void dep_prune_use(dep_node *root, const char *use)
+static void
+dep_prune_use(dep_node *root, const char *use)
{
if (root->neighbor) dep_prune_use(root->neighbor, use);
if (root->type == DEP_USE) {
@@ -351,7 +354,7 @@ _q_static void dep_prune_use(dep_node *root, const char *use)
if (root->children) dep_prune_use(root->children, use);
}
-_q_static char *
+static char *
_dep_flatten_tree(const dep_node *root, char *buf)
{
if (root->type == DEP_NULL) goto this_node_sucks;
@@ -367,7 +370,8 @@ this_node_sucks:
return buf;
}
-char *dep_flatten_tree(const dep_node *root)
+static char *
+dep_flatten_tree(const dep_node *root)
{
static char flat[1024 * 1024];
char *buf = _dep_flatten_tree(root, flat);
@@ -386,7 +390,8 @@ struct qdepends_opt_state {
const char *query;
};
-_q_static int qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
+static int
+qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
{
struct qdepends_opt_state *state = priv;
const char *catname = pkg_ctx->cat_ctx->name;
@@ -462,7 +467,8 @@ _q_static int qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
return ret;
}
-_q_static int qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
+static int
+qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
{
struct qdepends_opt_state *state = priv;
const char *catname = pkg_ctx->cat_ctx->name;
diff --git a/qfile.c b/qfile.c
index c6c3664..ec08491 100644
--- a/qfile.c
+++ b/qfile.c
@@ -65,7 +65,7 @@ struct qfile_opt_state {
* We assume the people calling us have chdir(/var/db/pkg) and so
* we use relative paths throughout here.
*/
-_q_static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
+static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
{
struct qfile_opt_state *state = priv;
const char *catname = pkg_ctx->cat_ctx->name;
@@ -238,7 +238,7 @@ _q_static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
return found;
}
-_q_static void destroy_qfile_args(qfile_args_t *qfile_args)
+static void destroy_qfile_args(qfile_args_t *qfile_args)
{
int i;
@@ -259,7 +259,7 @@ _q_static void destroy_qfile_args(qfile_args_t *qfile_args)
memset(qfile_args, 0, sizeof(qfile_args_t));
}
-_q_static int
+static int
prepare_qfile_args(const int argc, const char **argv, struct qfile_opt_state *state)
{
qfile_args_t *args = &state->args;
diff --git a/qglsa.c b/qglsa.c
index 6670093..74c5d39 100644
--- a/qglsa.c
+++ b/qglsa.c
@@ -33,8 +33,8 @@ typedef enum {
GLSA_FUNKYTOWN, GLSA_LIST, GLSA_DUMP, GLSA_TEST, GLSA_FIX, GLSA_INJECT
} qglsa_action;
-static char *qglsa_load_list(void);
-static char *qglsa_load_list(void)
+static char *
+qglsa_load_list(void)
{
char *file, *ret = NULL;
size_t size = 0;
@@ -43,8 +43,8 @@ static char *qglsa_load_list(void)
free(file);
return ret;
}
-static void qglsa_append_to_list(const char *glsa);
-static void qglsa_append_to_list(const char *glsa)
+static void
+qglsa_append_to_list(const char *glsa)
{
char *file;
FILE *f;
@@ -57,8 +57,8 @@ static void qglsa_append_to_list(const char *glsa)
free(file);
}
-static void qglsa_decode_entities(char *xml_buf, size_t len);
-static void qglsa_decode_entities(char *xml_buf, size_t len)
+static void
+qglsa_decode_entities(char *xml_buf, size_t len)
{
const char const *encoded[] = { "<", ">", """, "&"};
const char const *decoded[] = { "<", ">", "\"", "&"};
@@ -80,7 +80,8 @@ static void qglsa_decode_entities(char *xml_buf, size_t len)
}
}
-static char *qglsa_get_xml_tag_attribute(const char *xml_buf, const char *tag, const char *attribute)
+static char *
+qglsa_get_xml_tag_attribute(const char *xml_buf, const char *tag, const char *attribute)
{
static char tmp_buf[BUFSIZE];
char *start, *end, *start_attr, *end_attr;
@@ -114,7 +115,8 @@ static char *qglsa_get_xml_tag_attribute(const char *xml_buf, const char *tag, c
qglsa_decode_entities(tmp_buf, end-start);
return tmp_buf;
}
-static char *qglsa_get_xml_tag(const char *xml_buf, const char *tag)
+static char *
+qglsa_get_xml_tag(const char *xml_buf, const char *tag)
{
static char tmp_buf[BUFSIZE];
char *start, *end;
diff --git a/qgrep.c b/qgrep.c
index 73556ee..9d2752e 100644
--- a/qgrep.c
+++ b/qgrep.c
@@ -48,8 +48,8 @@ static const char * const qgrep_opts_help[] = {
};
#define qgrep_usage(ret) usage(ret, QGREP_FLAGS, qgrep_long_opts, qgrep_opts_help, NULL, lookup_applet_idx("qgrep"))
-char qgrep_name_match(const char*, const int, depend_atom**);
-char qgrep_name_match(const char* name, const int argc, depend_atom** argv)
+static char
+qgrep_name_match(const char* name, const int argc, depend_atom** argv)
{
depend_atom* atom;
int i;
@@ -89,8 +89,8 @@ typedef struct qgrep_buf {
/* Allocate <length> buffers in a circular list.
* <length> must be at least 1. */
-qgrep_buf_t* qgrep_buf_list_alloc(const char);
-qgrep_buf_t* qgrep_buf_list_alloc(const char length)
+static qgrep_buf_t *
+qgrep_buf_list_alloc(const char length)
{
char i;
qgrep_buf_t *head, *current;
@@ -104,8 +104,8 @@ qgrep_buf_t* qgrep_buf_list_alloc(const char length)
}
/* Free a circular buffers list. */
-void qgrep_buf_list_free(qgrep_buf_t *);
-void qgrep_buf_list_free(qgrep_buf_t *head)
+static void
+qgrep_buf_list_free(qgrep_buf_t *head)
{
qgrep_buf_t *current, *next;
next = head;
@@ -117,8 +117,8 @@ void qgrep_buf_list_free(qgrep_buf_t *head)
}
/* Set valid=0 in the whole list. */
-void qgrep_buf_list_invalidate(qgrep_buf_t *);
-void qgrep_buf_list_invalidate(qgrep_buf_t *head)
+static void
+qgrep_buf_list_invalidate(qgrep_buf_t *head)
{
qgrep_buf_t *current;
current = head;
@@ -132,11 +132,10 @@ void qgrep_buf_list_invalidate(qgrep_buf_t *head)
typedef char *(*QGREP_STR_FUNC) (const char *, const char *);
/* Display a buffer, with an optionnal prefix. */
-void qgrep_print_line(qgrep_buf_t *, const char *, const int, const char,
- const regex_t*, const QGREP_STR_FUNC, const char*);
-void qgrep_print_line(qgrep_buf_t *current, const char *label,
- const int line_number, const char zig, const regex_t* preg,
- const QGREP_STR_FUNC searchfunc, const char* searchstr)
+static void
+qgrep_print_line(qgrep_buf_t *current, const char *label,
+ const int line_number, const char zig, const regex_t* preg,
+ const QGREP_STR_FUNC searchfunc, const char* searchstr)
{
char *p = current->buf;
/* Print line prefix, when in verbose mode */
@@ -191,9 +190,9 @@ void qgrep_print_line(qgrep_buf_t *current, const char *label,
qgrep_print_line(buf, label, lineno, ':', NULL, searchfunc, searchstr)
/* Display a leading context (valid lines of the buffers list, but the matching one). */
-void qgrep_print_before_context(qgrep_buf_t *, const char, const char *, const int);
-void qgrep_print_before_context(qgrep_buf_t *current, const char num_lines_before,
- const char *label, const int match_line_number)
+static void
+qgrep_print_before_context(qgrep_buf_t *current, const char num_lines_before,
+ const char *label, const int match_line_number)
{
int line_number;
line_number = match_line_number - num_lines_before;
@@ -206,8 +205,8 @@ void qgrep_print_before_context(qgrep_buf_t *current, const char num_lines_befor
}
/* Yield the path of one of the installed ebuilds (from VDB). */
-char *get_next_installed_ebuild(char *, DIR *, struct dirent **, DIR **);
-char *get_next_installed_ebuild(char *ebuild_path, DIR *vdb_dir, struct dirent **cat_dirent_pt, DIR **cat_dir_pt)
+static char *
+get_next_installed_ebuild(char *ebuild_path, DIR *vdb_dir, struct dirent **cat_dirent_pt, DIR **cat_dir_pt)
{
struct dirent *pkg_dirent = NULL;
if (*cat_dirent_pt == NULL || *cat_dir_pt == NULL)
diff --git a/qlist.c b/qlist.c
index 91ed45c..cda4ca7 100644
--- a/qlist.c
+++ b/qlist.c
@@ -42,7 +42,8 @@ static const char * const qlist_opts_help[] = {
};
#define qlist_usage(ret) usage(ret, QLIST_FLAGS, qlist_long_opts, qlist_opts_help, NULL, lookup_applet_idx("qlist"))
-static char *grab_pkg_umap(q_vdb_pkg_ctx *pkg_ctx)
+static char *
+grab_pkg_umap(q_vdb_pkg_ctx *pkg_ctx)
{
static char umap[BUFSIZ];
static char *use, *iuse;
@@ -100,7 +101,8 @@ static char *grab_pkg_umap(q_vdb_pkg_ctx *pkg_ctx)
return umap;
}
-static const char *umapstr(char display, q_vdb_pkg_ctx *pkg_ctx)
+static const char *
+umapstr(char display, q_vdb_pkg_ctx *pkg_ctx)
{
static char buf[BUFSIZ];
char *umap = NULL;
@@ -117,7 +119,7 @@ static const char *umapstr(char display, q_vdb_pkg_ctx *pkg_ctx)
return buf;
}
-_q_static bool
+static bool
qlist_match(q_vdb_pkg_ctx *pkg_ctx, const char *name, depend_atom **name_atom, bool exact)
{
const char *catname = pkg_ctx->cat_ctx->name;
@@ -272,7 +274,8 @@ struct qlist_opt_state {
size_t buflen;
};
-_q_static int qlist_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
+static int
+qlist_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
{
struct qlist_opt_state *state = priv;
int i;
diff --git a/qlop.c b/qlop.c
index 30e9f2f..f0c35b7 100644
--- a/qlop.c
+++ b/qlop.c
@@ -47,7 +47,7 @@ static const char qlop_desc[] =
#define QLOP_LIST 0x01
#define QLOP_UNLIST 0x02
-_q_static void
+static void
print_seconds_for_earthlings(const unsigned long t)
{
unsigned dd, hh, mm, ss;
@@ -62,7 +62,7 @@ print_seconds_for_earthlings(const unsigned long t)
printf("%s%u%s second%s", GREEN, ss, NORM, (ss == 1 ? "" : "s"));
}
-_q_static const char *
+static const char *
chop_ctime(time_t t)
{
static char ctime_out[50];
@@ -72,7 +72,7 @@ chop_ctime(time_t t)
return ctime_out;
}
-_q_static unsigned long
+static unsigned long
show_merge_times(char *package, const char *logfile, int average, char human_readable,
time_t start_time, time_t end_time)
{
@@ -227,7 +227,7 @@ show_merge_times(char *package, const char *logfile, int average, char human_rea
return 0;
}
-_q_static void
+static void
show_emerge_history(int listflag, array_t *atoms, const char *logfile,
time_t start_time, time_t end_time)
{
@@ -327,7 +327,7 @@ New format:
1431764460: === Sync completed for gentoo
1431764493: *** terminating.
*/
-_q_static void
+static void
show_sync_history(const char *logfile, time_t start_time, time_t end_time)
{
FILE *fp;
@@ -376,7 +376,7 @@ show_sync_history(const char *logfile, time_t start_time, time_t end_time)
fclose(fp);
}
-_q_static void show_current_emerge(void);
+static void show_current_emerge(void);
#ifdef __linux__
# include <asm/param.h>
# include <elf.h>
@@ -401,7 +401,8 @@ static void init_hz(void)
hz = 100;
}
-static char *root_readlink(const int pid)
+static char *
+root_readlink(const int pid)
{
static char path[_Q_PATH_MAX];
char buf[_Q_PATH_MAX];
@@ -652,8 +653,8 @@ void show_current_emerge(void)
}
#endif
-_q_static
-bool parse_date(const char *sdate, time_t *t)
+static bool
+parse_date(const char *sdate, time_t *t)
{
struct tm tm;
const char *s;
diff --git a/qmerge.c b/qmerge.c
index 4ef156b..2c92599 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -98,13 +98,14 @@ struct llist_char_t {
typedef struct llist_char_t llist_char;
-_q_static void pkg_fetch(int, const depend_atom *, const struct pkg_t *);
-_q_static void pkg_merge(int, const depend_atom *, const struct pkg_t *);
-_q_static int pkg_unmerge(q_vdb_pkg_ctx *, queue *);
-_q_static struct pkg_t *grab_binpkg_info(const char *);
-_q_static char *find_binpkg(const char *);
-
-_q_static void fetch(const char *destdir, const char *src)
+static void pkg_fetch(int, const depend_atom *, const struct pkg_t *);
+static void pkg_merge(int, const depend_atom *, const struct pkg_t *);
+static int pkg_unmerge(q_vdb_pkg_ctx *, queue *);
+static struct pkg_t *grab_binpkg_info(const char *);
+static char *find_binpkg(const char *);
+
+static void
+fetch(const char *destdir, const char *src)
{
if (!binhost[0])
return;
@@ -166,7 +167,8 @@ _q_static void fetch(const char *destdir, const char *src)
fflush(stderr);
}
-_q_static void qmerge_initialize(void)
+static void
+qmerge_initialize(void)
{
if (strlen(BUSYBOX))
if (access(BUSYBOX, X_OK) != 0)
@@ -205,13 +207,15 @@ struct qmerge_bv_state {
char *retbuf;
};
-_q_static int qmerge_filter_cat(q_vdb_cat_ctx *cat_ctx, void *priv)
+static int
+qmerge_filter_cat(q_vdb_cat_ctx *cat_ctx, void *priv)
{
struct qmerge_bv_state *state = priv;
return !state->catname || strcmp(cat_ctx->name, state->catname) == 0;
}
-_q_static int qmerge_best_version_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
+static int
+qmerge_best_version_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
{
struct qmerge_bv_state *state = priv;
if (qlist_match(pkg_ctx, state->buf, NULL, true))
@@ -220,7 +224,8 @@ _q_static int qmerge_best_version_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
return 0;
}
-_q_static char *best_version(const char *catname, const char *pkgname)
+static char *
+best_version(const char *catname, const char *pkgname)
{
static int vdb_check = 1;
static char retbuf[4096];
@@ -255,7 +260,7 @@ _q_static char *best_version(const char *catname, const char *pkgname)
return retbuf;
}
-_q_static int
+static int
config_protected(const char *buf, int cp_argc, char **cp_argv,
int cpm_argc, char **cpm_argv)
{
@@ -281,7 +286,8 @@ config_protected(const char *buf, int cp_argc, char **cp_argv,
return 0;
}
-_q_static void crossmount_rm(const char *fname, const struct stat st)
+static void
+crossmount_rm(const char *fname, const struct stat st)
{
struct stat lst;
@@ -297,8 +303,8 @@ _q_static void crossmount_rm(const char *fname, const struct stat st)
rm_rf(fname);
}
-void install_mask_pwd(int iargc, char **iargv, const struct stat st);
-void install_mask_pwd(int iargc, char **iargv, const struct stat st)
+static void
+install_mask_pwd(int iargc, char **iargv, const struct stat st)
{
char buf[1024];
int i;
@@ -329,7 +335,7 @@ void install_mask_pwd(int iargc, char **iargv, const struct stat st)
}
}
-_q_static char *
+static char *
atom2str(const depend_atom *atom, char *buf, size_t size)
{
if (atom->PR_int)
@@ -339,7 +345,7 @@ atom2str(const depend_atom *atom, char *buf, size_t size)
return buf;
}
-_q_static char
+static char
qprint_tree_node(int level, const depend_atom *atom, const struct pkg_t *pkg)
{
char buf[1024];
@@ -407,7 +413,7 @@ qprint_tree_node(int level, const depend_atom *atom, const struct pkg_t *pkg)
return c;
}
-_q_static void
+static void
pkg_run_func_at(int dirfd, const char *vdb_path, const char *phases, const char *func, const char *D, const char *T)
{
const char *phase;
@@ -481,7 +487,7 @@ pkg_run_func_at(int dirfd, const char *vdb_path, const char *phases, const char
#define pkg_run_func(...) pkg_run_func_at(AT_FDCWD, __VA_ARGS__)
/* Copy one tree (the single package) to another tree (ROOT) */
-_q_static int
+static int
merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst,
FILE *contents, queue **objs, char **cpathp, int iargc, char **iargv,
int cp_argc, char **cp_argv, int cpm_argc, char **cpm_argv)
@@ -718,7 +724,7 @@ merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst,
}
/* Copy one tree (the single package) to another tree (ROOT) */
-_q_static int
+static int
merge_tree(const char *src, const char *dst, FILE *contents,
queue **objs, int iargc, char **iargv)
{
@@ -746,7 +752,7 @@ merge_tree(const char *src, const char *dst, FILE *contents,
}
/* oh shit getting into pkg mgt here. FIXME: write a real dep resolver. */
-_q_static void
+static void
pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg)
{
queue *objs;
@@ -1024,7 +1030,7 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg)
q_vdb_close(vdb_ctx);
}
-_q_static int
+static int
pkg_unmerge(q_vdb_pkg_ctx *pkg_ctx, queue *keep)
{
q_vdb_cat_ctx *cat_ctx = pkg_ctx->cat_ctx;
@@ -1207,7 +1213,8 @@ pkg_unmerge(q_vdb_pkg_ctx *pkg_ctx, queue *keep)
return ret;
}
-_q_static int unlink_empty(const char *buf)
+static int
+unlink_empty(const char *buf)
{
struct stat st;
if (stat(buf, &st) != -1)
@@ -1216,7 +1223,7 @@ _q_static int unlink_empty(const char *buf)
return -1;
}
-_q_static int
+static int
pkg_verify_checksums(char *fname, const struct pkg_t *pkg, const depend_atom *atom,
int strict, int display)
{
@@ -1260,7 +1267,7 @@ pkg_verify_checksums(char *fname, const struct pkg_t *pkg, const depend_atom *at
return ret;
}
-_q_static void
+static void
pkg_fetch(int level, const depend_atom *atom, const struct pkg_t *pkg)
{
char buf[_Q_PATH_MAX], str[_Q_PATH_MAX];
@@ -1330,7 +1337,7 @@ pkg_fetch(int level, const depend_atom *atom, const struct pkg_t *pkg)
}
}
-_q_static void
+static void
print_Pkg(int full, const depend_atom *atom, const struct pkg_t *pkg)
{
char *p = NULL;
@@ -1380,7 +1387,7 @@ print_Pkg(int full, const depend_atom *atom, const struct pkg_t *pkg)
}
}
-_q_static int
+static int
qmerge_unmerge_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
{
queue *todo = priv;
@@ -1394,13 +1401,13 @@ qmerge_unmerge_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
return 0;
}
-_q_static int
+static int
unmerge_packages(queue *todo)
{
return q_vdb_foreach_pkg(qmerge_unmerge_cb, todo, NULL);
}
-_q_static FILE *
+static FILE *
open_binpkg_index(void)
{
FILE *fp;
@@ -1451,7 +1458,7 @@ open_binpkg_index(void)
return fp;
}
-_q_static struct pkg_t *
+static struct pkg_t *
grab_binpkg_info(const char *name)
{
FILE *fp;
@@ -1553,7 +1560,7 @@ grab_binpkg_info(const char *name)
return rpkg;
}
-_q_static char *
+static char *
find_binpkg(const char *name)
{
FILE *fp;
@@ -1634,7 +1641,7 @@ find_binpkg(const char *name)
return best_match;
}
-_q_static int
+static int
parse_packages(queue *todo)
{
FILE *fp;
@@ -1766,7 +1773,7 @@ parse_packages(queue *todo)
return EXIT_SUCCESS;
}
-_q_static queue *
+static queue *
qmerge_add_set_file(const char *dir, const char *file, queue *set)
{
FILE *fp;
@@ -1796,7 +1803,7 @@ qmerge_add_set_file(const char *dir, const char *file, queue *set)
return set;
}
-_q_static void *
+static void *
qmerge_add_set_system(void *data, char *buf)
{
queue *set = data;
@@ -1821,7 +1828,7 @@ qmerge_add_set_system(void *data, char *buf)
/* XXX: note, this doesn't handle more complicated set files like
* the portage .ini files in /usr/share/portage/sets/ */
/* XXX: this code does not combine duplicate dependencies */
-_q_static queue *
+static queue *
qmerge_add_set(char *buf, queue *set)
{
if (strcmp(buf, "world") == 0)
@@ -1836,7 +1843,7 @@ qmerge_add_set(char *buf, queue *set)
return add_set(buf, set);
}
-_q_static int
+static int
qmerge_run(queue *todo)
{
if (uninstall)
diff --git a/qpkg.c b/qpkg.c
index 1c18edc..c54d735 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -30,15 +30,9 @@ extern char pretend;
static char *qpkg_bindir = NULL;
static int eclean = 0;
-/* global functions */
-int filter_tbz2(const struct dirent *);
-uint64_t qpkg_clean_dir(char *, queue *);
-int qpkg_clean(char *);
-const char *qpkg_get_bindir(void);
-int qpkg_make(depend_atom *);
-
/* checks to make sure this is a .tbz2 file. used by scandir() */
-int filter_tbz2(const struct dirent *dentry)
+static int
+filter_tbz2(const struct dirent *dentry)
{
if (dentry->d_name[0] == '.')
return 0;
@@ -48,7 +42,8 @@ int filter_tbz2(const struct dirent *dentry)
}
/* process a single dir for cleaning. dir can be a $PKGDIR, $PKGDIR/All/, $PKGDIR/$CAT */
-uint64_t qpkg_clean_dir(char *dirp, queue *vdb)
+static uint64_t
+qpkg_clean_dir(char *dirp, queue *vdb)
{
queue *ll;
struct dirent **fnames;
@@ -99,7 +94,8 @@ uint64_t qpkg_clean_dir(char *dirp, queue *vdb)
}
/* figure out what dirs we want to process for cleaning and display results. */
-int qpkg_clean(char *dirp)
+static int
+qpkg_clean(char *dirp)
{
FILE *fp;
int i, count;
@@ -178,7 +174,8 @@ int qpkg_clean(char *dirp)
return 0;
}
-const char *qpkg_get_bindir(void)
+static const char *
+qpkg_get_bindir(void)
{
if (qpkg_bindir != NULL)
return qpkg_bindir;
@@ -191,8 +188,8 @@ const char *qpkg_get_bindir(void)
return qpkg_bindir;
}
-int check_pkg_install_mask(char *name);
-int check_pkg_install_mask(char *name)
+static int
+check_pkg_install_mask(char *name)
{
int i, iargc, ret;
char **iargv;
@@ -214,7 +211,8 @@ int check_pkg_install_mask(char *name)
return ret;
}
-int qpkg_make(depend_atom *atom)
+static int
+qpkg_make(depend_atom *atom)
{
FILE *fp, *out;
char tmpdir[BUFSIZE], filelist[BUFSIZE], xpak[BUFSIZE], tbz2[BUFSIZE];
diff --git a/qsize.c b/qsize.c
index 376a772..b92f533 100644
--- a/qsize.c
+++ b/qsize.c
@@ -49,7 +49,8 @@ struct qsize_opt_state {
uint64_t num_all_bytes;
};
-_q_static int qsize_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
+static int
+qsize_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
{
struct qsize_opt_state *state = priv;
const char *catname = pkg_ctx->cat_ctx->name;
diff --git a/qtbz2.c b/qtbz2.c
index 6e6fff6..723ad27 100644
--- a/qtbz2.c
+++ b/qtbz2.c
@@ -49,8 +49,8 @@ static const char * const qtbz2_opts_help[] = {
static char tbz2_stdout = 0;
-unsigned char *tbz2_encode_int(int enc);
-unsigned char *tbz2_encode_int(int enc)
+static unsigned char *
+tbz2_encode_int(int enc)
{
static unsigned char ret[4];
ret[0] = (enc & 0xff000000) >> 24;
@@ -59,8 +59,8 @@ unsigned char *tbz2_encode_int(int enc)
ret[3] = (enc & 0x000000ff);
return ret;
}
-int tbz2_decode_int(unsigned char *buf);
-int tbz2_decode_int(unsigned char *buf)
+static int
+tbz2_decode_int(unsigned char *buf)
{
int ret;
ret = 0;
@@ -71,8 +71,8 @@ int tbz2_decode_int(unsigned char *buf)
return ret;
}
-void _tbz2_copy_file(FILE *src, FILE *dst);
-void _tbz2_copy_file(FILE *src, FILE *dst)
+static void
+_tbz2_copy_file(FILE *src, FILE *dst)
{
int count = 1;
unsigned char buffer[BUFSIZE*32];
diff --git a/tests/tests.h b/tests/tests.h
index cf96cf2..38838f8 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -19,6 +19,5 @@
} while (0)
#define err(...) errf(__VA_ARGS__)
#define errp(...) errf(__VA_ARGS__)
-#define _q_static static
#endif
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-29 2:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-29 2:25 [gentoo-commits] proj/portage-utils:master commit in: /, tests/, libq/ Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox