Mercurial > hg > batmud > maputils
changeset 63:a1c32d83be4d
Updates to th-libs
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 15 Dec 2006 07:48:04 +0000 |
parents | 62e7f68da4fc |
children | 60853e54395e |
files | th_util.c th_util.h |
diffstat | 2 files changed, 23 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/th_util.c Fri Dec 15 07:47:03 2006 +0000 +++ b/th_util.c Fri Dec 15 07:48:04 2006 +0000 @@ -22,7 +22,7 @@ BOOL th_isInitialized = FALSE; int th_verbosityLevel = 2; -char_t *th_prog_name = NULL, +char *th_prog_name = NULL, *th_prog_fullname = NULL, *th_prog_version = NULL, *th_prog_author = NULL, @@ -31,36 +31,35 @@ /* Initialize th_util-library and global variables */ -void th_init( - char_t *progName, char_t *progFullName, char_t *progVersion, - char_t *progAuthor, char_t *progLicense) +void th_init(char *progName, char *progFullName, char *progVersion, + char *progAuthor, char *progLicense) { /* Free previous values */ if (progName) th_prog_name = progName; - else + else th_prog_name = TH_PROG_NAME; if (progFullName) th_prog_fullname = progFullName; else th_prog_fullname = TH_PROG_FULLNAME; - + if (progVersion) th_prog_version = progVersion; else th_prog_version = TH_PROG_VERSION; - + if (progAuthor) th_prog_author = progAuthor; else th_prog_author = TH_PROG_AUTHOR; - + if (progLicense) th_prog_license = progLicense; else th_prog_license = TH_PROG_LICENSE; - + th_isInitialized = TRUE; } @@ -68,11 +67,11 @@ /* Print formatted error, warning and information messages * TODO: Implement th_vfprintf() and friends? */ -void THERR(const char_t *pcFormat, ...) +void THERR(const char *pcFormat, ...) { va_list ap; assert(th_isInitialized); - + va_start(ap, pcFormat); fprintf(stderr, "%s: ", th_prog_name); vfprintf(stderr, pcFormat, ap); @@ -80,11 +79,11 @@ } -void THMSG(int verbLevel, const char_t *pcFormat, ...) +void THMSG(int verbLevel, const char *pcFormat, ...) { va_list ap; assert(th_isInitialized); - + /* Check if the current verbosity level is enough */ if (th_verbosityLevel >= verbLevel) { va_start(ap, pcFormat); @@ -95,7 +94,7 @@ } -void THPRINT(int verbLevel, const char_t *pcFormat, ...) +void THPRINT(int verbLevel, const char *pcFormat, ...) { va_list ap; assert(th_isInitialized); @@ -134,10 +133,10 @@ void th_free(void *p) { - /* Check for NULL pointers for portability due to some libc - * implementations not handling free(NULL) too well. - */ - if (p) free(p); + /* Check for NULL pointers for portability due to some libc + * implementations not handling free(NULL) too well. + */ + if (p) free(p); }
--- a/th_util.h Fri Dec 15 07:47:03 2006 +0000 +++ b/th_util.h Fri Dec 15 07:48:04 2006 +0000 @@ -59,7 +59,7 @@ * Global variables */ extern int th_verbosityLevel; -extern char_t *th_prog_name, +extern char *th_prog_name, *th_prog_fullname, *th_prog_version, *th_prog_author, @@ -68,11 +68,11 @@ /* * Functions */ -void th_init(char_t *progName, char_t *progFullName, char_t *progVersion, - char_t *progAuthor, char_t *progLicense); -void THERR(const char_t *, ...); -void THMSG(int, const char_t *, ...); -void THPRINT(int, const char_t *, ...); +void th_init(char *progName, char *progFullName, char *progVersion, + char *progAuthor, char *progLicense); +void THERR(const char *, ...); +void THMSG(int, const char *, ...); +void THPRINT(int, const char *, ...); void * th_malloc(size_t); void * th_calloc(size_t, size_t);