diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-09 20:32:37 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-09 20:32:41 +0100 |
commit | aa28590647251cfd8f4f2b805a56c1b741aca565 (patch) | |
tree | befb4fa7fbdc9994596a833536f920245f509476 | |
parent | 4f347e7a16d8b0144c84e0a349f66fcd3b473f02 (diff) | |
download | pack-aa28590647251cfd8f4f2b805a56c1b741aca565.tar.gz pack-aa28590647251cfd8f4f2b805a56c1b741aca565.tar.xz pack-aa28590647251cfd8f4f2b805a56c1b741aca565.zip |
Make functions static
-rw-r--r-- | test_gen.c | 12 | ||||
-rw-r--r-- | trace.c | 2 | ||||
-rw-r--r-- | unpack.c | 2 | ||||
-rw-r--r-- | unpack_test.c | 2 |
4 files changed, 9 insertions, 9 deletions
@@ -19,14 +19,14 @@ struct { { LITTLE, "<" }, }; -char cchar(char c) +static char cchar(char c) { if (c == '\0') return c; if (isalnum(c)) return c; return '_'; } -const char *cname(const char *s) +static const char *cname(const char *s) { static char ret[100]; for (int i = 0; i < 99; i++) { @@ -36,7 +36,7 @@ const char *cname(const char *s) return ret; } -const char *u2bytes(enum endian e, int n, uintmax_t v) +static const char *u2bytes(enum endian e, int n, uintmax_t v) { static char b[100]; char *p = b; @@ -52,7 +52,7 @@ const char *u2bytes(enum endian e, int n, uintmax_t v) return b; } -uintmax_t i2u(int n, intmax_t v) +static uintmax_t i2u(int n, intmax_t v) { if (v >= 0) return v; @@ -60,12 +60,12 @@ uintmax_t i2u(int n, intmax_t v) return (UINTMAX_MAX >> (sizeof (uintmax_t) * CHAR_BIT - n * 8)) + v + 1; } -const char *i2bytes(enum endian e, int n, intmax_t v) +static const char *i2bytes(enum endian e, int n, intmax_t v) { return u2bytes(e, n, i2u(n, v)); } -void generate_simple(FILE *out, char fmt, const char *type, intmax_t min, uintmax_t max, int size) +static void generate_simple(FILE *out, char fmt, const char *type, intmax_t min, uintmax_t max, int size) { unsigned char data[8]; char *prefix; @@ -10,7 +10,7 @@ enum pack_trace pack_trace = PACK_TRACE_OFF; -void trace(enum pack_trace level, const char *fmt, va_list va) +static void trace(enum pack_trace level, const char *fmt, va_list va) { char *type; @@ -15,7 +15,7 @@ enum endian { BIG, LITTLE }; -uintmax_t read_val(unsigned char *buf, size_t size, enum endian e) +static uintmax_t read_val(unsigned char *buf, size_t size, enum endian e) { uintmax_t val = 0; diff --git a/unpack_test.c b/unpack_test.c index f89cd62..d6e5a5e 100644 --- a/unpack_test.c +++ b/unpack_test.c @@ -16,7 +16,7 @@ struct test { char *desc; }; -#define TEST(name) bool test_##name(void) +#define TEST(name) static bool test_##name(void) #define TEST_ENTRY(name, description) { test_##name, description } #define TEST_ENTRY_END { NULL, NULL } #define DATA(...) (unsigned char []){ __VA_ARGS__ }, sizeof (unsigned char []){ __VA_ARGS__ } |