diff options
Diffstat (limited to 'mkprecompiled.c')
-rw-r--r-- | mkprecompiled.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/mkprecompiled.c b/mkprecompiled.c index e1f23d5..0c75a9f 100644 --- a/mkprecompiled.c +++ b/mkprecompiled.c | |||
@@ -85,14 +85,13 @@ typedef struct { | |||
85 | 85 | ||
86 | #include "crc.h" | 86 | #include "crc.h" |
87 | 87 | ||
88 | |||
89 | /* | 88 | /* |
90 | * nv_alloc() - malloc wrapper that checks for errors, and zeros out | 89 | * nv_alloc() - malloc wrapper that checks for errors, and zeros out |
91 | * the memory; if an error occurs, an error is printed to stderr and | 90 | * the memory; if an error occurs, an error is printed to stderr and |
92 | * exit() is called -- this function will only return on success. | 91 | * exit() is called -- this function will only return on success. |
93 | */ | 92 | */ |
94 | 93 | ||
95 | void *nv_alloc (size_t size) | 94 | static void *nv_alloc (size_t size) |
96 | { | 95 | { |
97 | void *m = malloc (size); | 96 | void *m = malloc (size); |
98 | 97 | ||
@@ -110,11 +109,15 @@ void *nv_alloc (size_t size) | |||
110 | * XXX hack to resolve symbols used by crc.c | 109 | * XXX hack to resolve symbols used by crc.c |
111 | */ | 110 | */ |
112 | 111 | ||
112 | void *nvalloc(size_t size); | ||
113 | |||
113 | void *nvalloc(size_t size) | 114 | void *nvalloc(size_t size) |
114 | { | 115 | { |
115 | return nv_alloc(size); | 116 | return nv_alloc(size); |
116 | } | 117 | } |
117 | 118 | ||
119 | void ui_warn(Options *op, const char *fmt, ...); | ||
120 | |||
118 | void ui_warn(Options *op, const char *fmt, ...) | 121 | void ui_warn(Options *op, const char *fmt, ...) |
119 | { | 122 | { |
120 | va_list ap; | 123 | va_list ap; |
@@ -131,7 +134,7 @@ void ui_warn(Options *op, const char *fmt, ...) | |||
131 | * fails and calls exit(). This function only returns on success. | 134 | * fails and calls exit(). This function only returns on success. |
132 | */ | 135 | */ |
133 | 136 | ||
134 | int nv_open(const char *pathname, int flags, mode_t mode) | 137 | static int nv_open(const char *pathname, int flags, mode_t mode) |
135 | { | 138 | { |
136 | int fd; | 139 | int fd; |
137 | fd = open(pathname, flags, mode); | 140 | fd = open(pathname, flags, mode); |
@@ -152,7 +155,7 @@ int nv_open(const char *pathname, int flags, mode_t mode) | |||
152 | * on success. | 155 | * on success. |
153 | */ | 156 | */ |
154 | 157 | ||
155 | int nv_get_file_length(const char *filename) | 158 | static int nv_get_file_length(const char *filename) |
156 | { | 159 | { |
157 | struct stat stat_buf; | 160 | struct stat stat_buf; |
158 | int ret; | 161 | int ret; |
@@ -175,7 +178,7 @@ int nv_get_file_length(const char *filename) | |||
175 | * function only returns on success. | 178 | * function only returns on success. |
176 | */ | 179 | */ |
177 | 180 | ||
178 | void nv_set_file_length(const char *filename, int fd, int len) | 181 | static void nv_set_file_length(const char *filename, int fd, int len) |
179 | { | 182 | { |
180 | if ((lseek(fd, len - 1, SEEK_SET) == -1) || | 183 | if ((lseek(fd, len - 1, SEEK_SET) == -1) || |
181 | (write(fd, "", 1) == -1)) { | 184 | (write(fd, "", 1) == -1)) { |
@@ -192,7 +195,8 @@ void nv_set_file_length(const char *filename, int fd, int len) | |||
192 | * fails and calls exit(). This function only returns on success. | 195 | * fails and calls exit(). This function only returns on success. |
193 | */ | 196 | */ |
194 | 197 | ||
195 | void *nv_mmap(const char *filename, size_t len, int prot, int flags, int fd) | 198 | static void *nv_mmap(const char *filename, size_t len, int prot, |
199 | int flags, int fd) | ||
196 | { | 200 | { |
197 | void *ret; | 201 | void *ret; |
198 | 202 | ||
@@ -212,7 +216,7 @@ void *nv_mmap(const char *filename, size_t len, int prot, int flags, int fd) | |||
212 | * print_help() | 216 | * print_help() |
213 | */ | 217 | */ |
214 | 218 | ||
215 | void print_help(void) | 219 | static void print_help(void) |
216 | { | 220 | { |
217 | printf("\n%s [options] \n\n", BINNAME); | 221 | printf("\n%s [options] \n\n", BINNAME); |
218 | 222 | ||
@@ -254,7 +258,7 @@ void print_help(void) | |||
254 | * structure. | 258 | * structure. |
255 | */ | 259 | */ |
256 | 260 | ||
257 | Options *parse_commandline(int argc, char *argv[]) | 261 | static Options *parse_commandline(int argc, char *argv[]) |
258 | { | 262 | { |
259 | Options *op; | 263 | Options *op; |
260 | int c, option_index = 0; | 264 | int c, option_index = 0; |
@@ -336,7 +340,7 @@ Options *parse_commandline(int argc, char *argv[]) | |||
336 | 340 | ||
337 | 341 | ||
338 | 342 | ||
339 | char *read_proc_version(void) | 343 | static char *read_proc_version(void) |
340 | { | 344 | { |
341 | int fd, ret, len, version_len; | 345 | int fd, ret, len, version_len; |
342 | char *version, *c = NULL; | 346 | char *version, *c = NULL; |
@@ -390,7 +394,7 @@ char *read_proc_version(void) | |||
390 | * Returns 1 if the strings match, 0 if they don't match. | 394 | * Returns 1 if the strings match, 0 if they don't match. |
391 | */ | 395 | */ |
392 | 396 | ||
393 | int check_match(char *str) | 397 | static int check_match(char *str) |
394 | { | 398 | { |
395 | int ret = 0; | 399 | int ret = 0; |
396 | char *version = read_proc_version(); | 400 | char *version = read_proc_version(); |
@@ -416,7 +420,7 @@ int check_match(char *str) | |||
416 | * the integer to the data buffer. | 420 | * the integer to the data buffer. |
417 | */ | 421 | */ |
418 | 422 | ||
419 | void encode_uint32(uint32 val, uint8 data[4]) | 423 | static void encode_uint32(uint32 val, uint8 data[4]) |
420 | { | 424 | { |
421 | data[0] = ((val >> 0) & 0xff); | 425 | data[0] = ((val >> 0) & 0xff); |
422 | data[1] = ((val >> 8) & 0xff); | 426 | data[1] = ((val >> 8) & 0xff); |
@@ -432,7 +436,7 @@ void encode_uint32(uint32 val, uint8 data[4]) | |||
432 | * bytes, and build a uint32. | 436 | * bytes, and build a uint32. |
433 | */ | 437 | */ |
434 | 438 | ||
435 | uint32 decode_uint32(char *buf) | 439 | static uint32 decode_uint32(char *buf) |
436 | { | 440 | { |
437 | uint32 ret = 0; | 441 | uint32 ret = 0; |
438 | 442 | ||
@@ -460,7 +464,7 @@ uint32 decode_uint32(char *buf) | |||
460 | * string, and the proc version string. | 464 | * string, and the proc version string. |
461 | */ | 465 | */ |
462 | 466 | ||
463 | int pack(Options *op) | 467 | static int pack(Options *op) |
464 | { | 468 | { |
465 | int fd, offset, src_fd; | 469 | int fd, offset, src_fd; |
466 | uint8 *out, *src, data[4]; | 470 | uint8 *out, *src, data[4]; |
@@ -571,7 +575,7 @@ int pack(Options *op) | |||
571 | * unpack() - unpack the specified package | 575 | * unpack() - unpack the specified package |
572 | */ | 576 | */ |
573 | 577 | ||
574 | int unpack(Options *op) | 578 | static int unpack(Options *op) |
575 | { | 579 | { |
576 | int dst_fd, fd, ret, offset, len = 0; | 580 | int dst_fd, fd, ret, offset, len = 0; |
577 | char *buf, *dst; | 581 | char *buf, *dst; |