aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-02-07 17:19:44 -0600
committerRob Landley <rob@landley.net>2021-02-07 17:19:44 -0600
commit664c417af5d16e217557468ba747a369e8e1ab6b (patch)
tree028aacc085207ef347fdaa9eb1ccf86d06257208 /lib
parent9f7f62615f3963591af33fcc7582867f7063efd2 (diff)
downloadtoybox-664c417af5d16e217557468ba747a369e8e1ab6b.tar.gz
Add lots of "static" annotations, make a couple things use FLAG() macros, etc.
Diffstat (limited to 'lib')
-rw-r--r--lib/args.c2
-rw-r--r--lib/deflate.c12
-rw-r--r--lib/dirtree.c4
-rw-r--r--lib/env.c2
-rw-r--r--lib/lib.c2
-rw-r--r--lib/lib.h4
6 files changed, 13 insertions, 13 deletions
diff --git a/lib/args.c b/lib/args.c
index f5d3dc24..ef23cc07 100644
--- a/lib/args.c
+++ b/lib/args.c
@@ -228,7 +228,7 @@ static int gotflag(struct getoptflagstate *gof, struct opts *opt, int shrt)
// Parse this command's options string into struct getoptflagstate, which
// includes a struct opts linked list in reverse order (I.E. right-to-left)
-int parse_optflaglist(struct getoptflagstate *gof)
+static int parse_optflaglist(struct getoptflagstate *gof)
{
char *options = toys.which->options;
long *nextarg = (long *)&this;
diff --git a/lib/deflate.c b/lib/deflate.c
index 8c724429..cdc4f8d3 100644
--- a/lib/deflate.c
+++ b/lib/deflate.c
@@ -37,7 +37,7 @@ struct bitbuf {
};
// malloc a struct bitbuf
-struct bitbuf *bitbuf_init(int fd, int size)
+static struct bitbuf *bitbuf_init(int fd, int size)
{
struct bitbuf *bb = xzalloc(sizeof(struct bitbuf)+size);
@@ -49,7 +49,7 @@ struct bitbuf *bitbuf_init(int fd, int size)
// Advance bitpos without the overhead of recording bits
// Loads more data when input buffer empty
-void bitbuf_skip(struct bitbuf *bb, int bits)
+static void bitbuf_skip(struct bitbuf *bb, int bits)
{
int pos = bb->bitpos + bits, len = bb->len << 3;
@@ -75,7 +75,7 @@ static inline int bitbuf_bit(struct bitbuf *bb)
}
// Fetch the next X bits from the bitbuf, little endian
-unsigned bitbuf_get(struct bitbuf *bb, int bits)
+static unsigned bitbuf_get(struct bitbuf *bb, int bits)
{
int result = 0, offset = 0;
@@ -98,7 +98,7 @@ unsigned bitbuf_get(struct bitbuf *bb, int bits)
return result;
}
-void bitbuf_flush(struct bitbuf *bb)
+static void bitbuf_flush(struct bitbuf *bb)
{
if (!bb->bitpos) return;
@@ -107,7 +107,7 @@ void bitbuf_flush(struct bitbuf *bb)
bb->bitpos = 0;
}
-void bitbuf_put(struct bitbuf *bb, int data, int len)
+static void bitbuf_put(struct bitbuf *bb, int data, int len)
{
while (len) {
int click = bb->bitpos >> 3, blow, blen;
@@ -411,7 +411,7 @@ static int is_gzip(struct bitbuf *bb)
return 1;
}
-void gzip_crc(struct deflate *dd, char *data, int len)
+static void gzip_crc(struct deflate *dd, char *data, int len)
{
int i;
unsigned crc, *crc_table = dd->crctable;
diff --git a/lib/dirtree.c b/lib/dirtree.c
index 8c3b6a1c..43ecbd85 100644
--- a/lib/dirtree.c
+++ b/lib/dirtree.c
@@ -113,8 +113,8 @@ int dirtree_parentfd(struct dirtree *node)
// returns NULL. If !callback return top node unchanged.
// If !new return DIRTREE_ABORTVAL
-struct dirtree *dirtree_handle_callback(struct dirtree *new,
- int (*callback)(struct dirtree *node))
+static struct dirtree *dirtree_handle_callback(struct dirtree *new,
+ int (*callback)(struct dirtree *node))
{
int flags;
diff --git a/lib/env.c b/lib/env.c
index 70fb0def..facde63f 100644
--- a/lib/env.c
+++ b/lib/env.c
@@ -8,7 +8,7 @@ extern char **environ;
// Returns the number of bytes taken by the environment variables. For use
// when calculating the maximum bytes of environment+argument data that can
// be passed to exec for find(1) and xargs(1).
-long environ_bytes()
+long environ_bytes(void)
{
long bytes = sizeof(char *);
char **ev;
diff --git a/lib/lib.c b/lib/lib.c
index dfa4499f..de67efa2 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -926,7 +926,7 @@ void sigatexit(void *handler)
}
// Output a nicely formatted table of all the signals.
-void list_signals()
+void list_signals(void)
{
int i = 0, count = 0;
unsigned cols = 80;
diff --git a/lib/lib.h b/lib/lib.h
index 431ce5ad..f9c04281 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -287,7 +287,7 @@ int human_readable(char *buf, unsigned long long num, int style);
// env.c
-long environ_bytes();
+long environ_bytes(void);
char *xsetenv(char *name, char *val);
void xunsetenv(char *name);
char *xpop_env(char *name); // because xpopenv() looks like xpopen_v()
@@ -404,7 +404,7 @@ struct mtab_list *xgetmountlist(char *path);
void generic_signal(int signal);
void exit_signal(int signal);
void sigatexit(void *handler);
-void list_signals();
+void list_signals(void);
mode_t string_to_mode(char *mode_str, mode_t base);
void mode_to_string(mode_t mode, char *buf);