wdvi

network DVI viewer
Log | Files | Refs

commit a439fc1a0184bb14b6a5acc677694d87960679e8
parent a477625912c7d842e5e0de4df63195bfb10eb381
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Sun, 12 Sep 2021 16:02:03 +0000

tidy up function prototypes and headers

Diffstat:
Mutil.c | 22+++++++---------------
Mutil.h | 9++++++---
2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/util.c b/util.c @@ -37,8 +37,8 @@ NOTE: #include <pwd.h> /* getpwuid(), getpwnam() */ #include <unistd.h> /* getuid(), getpid() */ -#include "xdvi.h" #include "util.h" +#include "xdvi.h" /* @@ -50,26 +50,23 @@ NOTE: */ void * -xmalloc(size) - unsigned size; +xmalloc(size_t size) { void *mem = malloc(size); if (mem == NULL) - err(1, "malloc %u bytes", size); + err(1, "malloc %zu bytes", size); return mem; } void * -xrealloc(where, size) - void *where; - unsigned size; +xrealloc(void *where, size_t size) { void *mem = realloc(where, size); if (mem == NULL) - err(1, "realloc %u bytes", size); + err(1, "realloc %zu bytes", size); return mem; } @@ -142,9 +139,7 @@ alloc_bitmap(bitmap) * Put a variable in the environment or abort on error. */ void -xputenv(var, value) - const char *var; - const char *value; +xputenv(const char *var, const char *value) { if (setenv(var, value, True) != 0) err(1, "setenv"); @@ -160,10 +155,7 @@ xputenv(var, value) */ int -memicmp(s1, s2, n) - const char *s1; - const char *s2; - size_t n; +memicmp(const char *s1, const char *s2, size_t n) { while (n > 0) { int i = tolower(*s1) - *s2; diff --git a/util.h b/util.h @@ -1,7 +1,10 @@ #include <dirent.h> /* DIR */ #include <stdio.h> /* FILE */ -#include "data.h" /* struct bitmap */ +#include <X11/Intrinsic.h> /* Boolean */ + +#include "data.h" /* struct bitmap, struct avl */ + #define ROUNDUP(x,y) (((x)+(y)-1)/(y)) @@ -19,8 +22,8 @@ DIR *xopendir(const char *); int xpipe(int *); void xputenv(const char *, const char *); -void *xmalloc(unsigned); -void *xrealloc(void *, unsigned); +void *xmalloc(size_t); +void *xrealloc(void *, size_t); char *xstrdup(const char *); char *xmemdup(const char *, size_t);