From b8f0fedbe7de1fecba40fd59a5d63e0f62ea57e0 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 1 Jun 2000 19:14:59 +0000 Subject: [PATCH] Megacommit of many files. Mostly, several functions that take pointers as arguments, almost always char * pointers, had those pointers qualified with "const". Those that returned pointers to previously const-qualified arguments had their return values qualified as const. Some structure members were qualified as const to retain that attribute from the variables from which they were assigned. Minor other ISC style cleanups. --- lib/tests/include/tests/t_api.h | 8 ++--- lib/tests/t_api.c | 62 +++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/lib/tests/include/tests/t_api.h b/lib/tests/include/tests/t_api.h index 7bbbaa40c0..50281a1aa1 100644 --- a/lib/tests/include/tests/t_api.h +++ b/lib/tests/include/tests/t_api.h @@ -53,8 +53,8 @@ typedef void (*PFV)(void); typedef struct { - PFV pfv; - char *func_name; + PFV pfv; + const char *func_name; } testspec_t; extern int T_debug; @@ -78,14 +78,14 @@ t_fgetbs(FILE *fp); isc_result_t t_dns_result_fromtext(char *result); -int +unsigned int t_dc_method_fromtext(char *dc_method); int t_bustline(char *line, char **toks); int -t_eval(char *filename, int (*func)(char **), int nargs); +t_eval(const char *filename, int (*func)(char **), int nargs); #endif /* TESTS_T_API_H */ diff --git a/lib/tests/t_api.c b/lib/tests/t_api.c index 42baf3e247..a08acbba2a 100644 --- a/lib/tests/t_api.c +++ b/lib/tests/t_api.c @@ -38,7 +38,8 @@ #include "include/tests/t_api.h" -static char *Usage = "\t-a : run all tests\n" +static const char *Usage = + "\t-a : run all tests\n" "\t-b : chdir to dir before running tests" "\t-c : use specified config file\n" "\t-d : set debug level to debug_level\n" @@ -69,21 +70,32 @@ static char *Usage = "\t-a : run all tests\n" #define T_TCTOUT 60 -int T_debug; -int T_timeout; -pid_t T_pid; -static char *T_config; -static char T_tvec[T_MAXTESTS / 8]; -static char *T_env[T_MAXENV + 1]; -static char T_buf[T_BIGBUF]; -static char *T_dir; +int T_debug; +int T_timeout; +pid_t T_pid; +static const char * T_config; +static char T_tvec[T_MAXTESTS / 8]; +static char * T_env[T_MAXENV + 1]; +static char T_buf[T_BIGBUF]; +static char * T_dir; -static int t_initconf(char *path); -static int t_dumpconf(char *path); -static int t_putinfo(const char *key, const char *info); -static char *t_getdate(char *buf, size_t buflen); -static void printhelp(void); -static void printusage(void); +static int +t_initconf(const char *path); + +static int +t_dumpconf(const char *path); + +static int +t_putinfo(const char *key, const char *info); + +static char * +t_getdate(char *buf, size_t buflen); + +static void +printhelp(void); + +static void +printusage(void); static int T_int; @@ -358,7 +370,7 @@ t_info(const char *format, ...) { void t_result(int result) { - char *p; + const char *p; switch (result) { case T_PASS: @@ -417,7 +429,7 @@ t_getenv(const char *name) { */ static int -t_initconf(char *path) { +t_initconf(const char *path) { int n; int rval; @@ -457,7 +469,7 @@ t_initconf(char *path) { */ static int -t_dumpconf(char *path) { +t_dumpconf(const char *path) { int rval; char **p; FILE *fp; @@ -563,7 +575,7 @@ t_getdate(char *buf, size_t buflen) { */ struct dns_errormap { isc_result_t result; - char *text; + const char *text; } dns_errormap[] = { { ISC_R_SUCCESS, "ISC_R_SUCCESS" }, { ISC_R_EXISTS, "ISC_R_EXISTS" }, @@ -631,8 +643,8 @@ t_dns_result_fromtext(char *name) { } struct dc_method_map { - int dc_method; - char *text; + unsigned int dc_method; + const char *text; } dc_method_map[] = { { DNS_COMPRESS_NONE, "DNS_COMPRESS_NONE" }, @@ -643,10 +655,9 @@ struct dc_method_map { { 0, NULL } }; -int +unsigned int t_dc_method_fromtext(char *name) { - - int dc_method; + unsigned int dc_method; struct dc_method_map *pmap; dc_method = DNS_COMPRESS_NONE; @@ -666,7 +677,6 @@ t_dc_method_fromtext(char *name) { int t_bustline(char *line, char **toks) { - int cnt; char *p; @@ -703,7 +713,7 @@ printusage(void) { } int -t_eval(char *filename, int (*func)(char **), int nargs) { +t_eval(const char *filename, int (*func)(char **), int nargs) { FILE *fp; char *p; int line;