String constants are const.

This commit is contained in:
thorpej 2000-05-14 02:29:30 +00:00
parent bcb03e10af
commit f5a2f2d1fc
31 changed files with 59 additions and 61 deletions

View File

@ -214,7 +214,7 @@ static HTABLE *dict_open_hash;
static void dict_open_init(void)
{
char *myname = "dict_open_init";
const char *myname = "dict_open_init";
DICT_OPEN_INFO *dp;
if (dict_open_hash != 0)
@ -247,7 +247,7 @@ DICT *dict_open(const char *dict_spec, int open_flags, int dict_flags)
DICT *dict_open3(const char *dict_type, const char *dict_name,
int open_flags, int dict_flags)
{
char *myname = "dict_open";
const char *myname = "dict_open";
DICT_OPEN_INFO *dp;
DICT *dict;
@ -267,7 +267,7 @@ DICT *dict_open3(const char *dict_type, const char *dict_name,
void dict_open_register(const char *type,
DICT *(*open) (const char *, int, int))
{
char *myname = "dict_open_register";
const char *myname = "dict_open_register";
DICT_OPEN_INFO *dp;
if (dict_open_hash == 0)

View File

@ -333,11 +333,11 @@ static DICT_REGEXP_RULE *dict_regexp_parseline(int lineno, char *line, int *nsub
if (!*p) {
msg_warn("%s, line %d: no replacement text: using empty string",
VSTREAM_PATH(map_fp), lineno);
p = "";
/* tested again below... */
}
rule->expr[0] = expr1;
rule->expr[1] = expr2;
rule->replace = mystrdup(p);
rule->replace = mystrdup((*p == 0) ? "" : p);
rule->lineno = lineno;
rule->next = NULL;
return rule;

View File

@ -61,7 +61,7 @@
char *dir_forest(VSTRING *buf, const char *path, int depth)
{
char *myname = "dir_forest";
const char *myname = "dir_forest";
static VSTRING *private_buf = 0;
int n;
const char *cp;

View File

@ -246,7 +246,7 @@ time_t event_time(void)
void event_enable_read(int fd, EVENT_NOTIFY_RDWR callback, char *context)
{
char *myname = "event_enable_read";
const char *myname = "event_enable_read";
EVENT_FDTABLE *fdp;
if (EVENT_INIT_NEEDED())
@ -285,7 +285,7 @@ void event_enable_read(int fd, EVENT_NOTIFY_RDWR callback, char *context)
void event_enable_write(int fd, EVENT_NOTIFY_RDWR callback, char *context)
{
char *myname = "event_enable_write";
const char *myname = "event_enable_write";
EVENT_FDTABLE *fdp;
if (EVENT_INIT_NEEDED())
@ -324,7 +324,7 @@ void event_enable_write(int fd, EVENT_NOTIFY_RDWR callback, char *context)
void event_disable_readwrite(int fd)
{
char *myname = "event_disable_readwrite";
const char *myname = "event_disable_readwrite";
EVENT_FDTABLE *fdp;
if (EVENT_INIT_NEEDED())
@ -355,7 +355,7 @@ void event_disable_readwrite(int fd)
time_t event_request_timer(EVENT_NOTIFY_TIME callback, char *context, int delay)
{
char *myname = "event_request_timer";
const char *myname = "event_request_timer";
RING *ring;
EVENT_TIMER *timer;
@ -419,7 +419,7 @@ time_t event_request_timer(EVENT_NOTIFY_TIME callback, char *context, int del
int event_cancel_timer(EVENT_NOTIFY_TIME callback, char *context)
{
char *myname = "event_cancel_timer";
const char *myname = "event_cancel_timer";
RING *ring;
EVENT_TIMER *timer;
int time_left = -1;
@ -452,7 +452,7 @@ int event_cancel_timer(EVENT_NOTIFY_TIME callback, char *context)
void event_loop(int delay)
{
char *myname = "event_loop";
const char *myname = "event_loop";
static int nested;
fd_set rmask;
fd_set wmask;

View File

@ -52,7 +52,7 @@ int fifo_listen(const char *path, int permissions, int block_mode)
{
char buf[BUF_LEN];
static int open_mode = 0;
char *myname = "fifo_listen";
const char *myname = "fifo_listen";
struct stat st;
int fd;
int count;

View File

@ -55,7 +55,7 @@
int fifo_trigger(const char *service, const char *buf, int len, int timeout)
{
char *myname = "fifo_trigger";
const char *myname = "fifo_trigger";
int fd;
/*

View File

@ -67,7 +67,7 @@
void fsspace(const char *path, struct fsspace * sp)
{
char *myname = "fsspace";
const char *myname = "fsspace";
#ifdef USE_STATFS
#ifdef USE_STRUCT_FS_DATA /* Ultrix */

View File

@ -64,7 +64,7 @@ void inet_addr_list_init(INET_ADDR_LIST *list)
void inet_addr_list_append(INET_ADDR_LIST *list, struct in_addr * addr)
{
char *myname = "inet_addr_list_append";
const char *myname = "inet_addr_list_append";
if (msg_verbose > 1)
msg_info("%s: %s", myname, inet_ntoa(*addr));

View File

@ -70,7 +70,7 @@
int inet_addr_local(INET_ADDR_LIST *addr_list)
{
char *myname = "inet_addr_local";
const char *myname = "inet_addr_local";
struct ifconf ifc;
struct ifreq *ifr;
struct ifreq *the_end;

View File

@ -81,11 +81,9 @@ int inet_connect(const char *addr, int block_mode, int timeout)
* the local host.
*/
buf = inet_parse(addr, &host, &port);
if (*host == 0)
host = "localhost";
memset((char *) &sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = find_inet_addr(host);
sin.sin_addr.s_addr = find_inet_addr((*host == 0) ? "localhost" : host);
sin.sin_port = find_inet_port(port, "tcp");
myfree(buf);

View File

@ -59,7 +59,7 @@
int inet_trigger(const char *service, const char *buf, int len, int timeout)
{
char *myname = "inet_trigger";
const char *myname = "inet_trigger";
int fd;
if (msg_verbose > 1)

View File

@ -55,7 +55,7 @@ char *inet_parse(const char *addr, char **hostp, char **portp)
*hostp = buf;
} else {
*portp = buf;
*hostp = "";
*hostp = ""; /* XXX bogus -- string constants not writeable */
}
return (buf);
}

View File

@ -115,7 +115,7 @@ typedef struct {
static int mac_expand_callback(int type, VSTRING *buf, char *ptr)
{
char *myname = "mac_expand_callback";
const char *myname = "mac_expand_callback";
MAC_EXP *mc = (MAC_EXP *) ptr;
int lookup_mode;
const char *text;

View File

@ -80,7 +80,7 @@
int mac_parse(const char *value, MAC_PARSE_FN action, char *context)
{
char *myname = "mac_parse";
const char *myname = "mac_parse";
VSTRING *buf = vstring_alloc(1); /* result buffer */
const char *vp; /* value pointer */
const char *pp; /* open_paren pointer */

View File

@ -88,10 +88,10 @@ struct MATCH_LIST {
static ARGV *match_list_parse(ARGV *list, char *string)
{
char *myname = "match_list_parse";
const char *myname = "match_list_parse";
VSTRING *buf = 0;
VSTREAM *fp;
char *delim = " ,\t\r\n";
const char *delim = " ,\t\r\n";
char *bp = string;
char *pattern;
char *cp;
@ -154,7 +154,7 @@ MATCH_LIST *match_list_init(const char *patterns, int match_count,...)
int match_list_match(MATCH_LIST * list,...)
{
char *myname = "match_list_match";
const char *myname = "match_list_match";
char **cpp;
char *pat;
int match;

View File

@ -74,7 +74,7 @@
int match_string(const char *string, const char *pattern)
{
char *myname = "match_string";
const char *myname = "match_string";
int match;
char *key;
@ -112,7 +112,7 @@ int match_string(const char *string, const char *pattern)
int match_hostname(const char *name, const char *pattern)
{
char *myname = "match_hostname";
const char *myname = "match_hostname";
const char *pd;
const char *entry;
char *next;
@ -183,7 +183,7 @@ static int match_parse_mask(const char *pattern, unsigned long *net_bits,
int match_hostaddr(const char *addr, const char *pattern)
{
char *myname = "match_hostaddr";
const char *myname = "match_hostaddr";
int mask_shift;
unsigned long mask_bits;
unsigned long net_bits;

View File

@ -59,10 +59,10 @@
static void msg_syslog_print(int level, const char *text)
{
static int log_level[] = {
static const int log_level[] = {
LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT,
};
static char *severity_name[] = {
static const char *severity_name[] = {
"info", "warning", "error", "fatal", "panic",
};

View File

@ -56,7 +56,7 @@ static VSTREAM *msg_stream;
static void msg_vstream_print(int level, const char *text)
{
static char *level_text[] = {
static const char *level_text[] = {
"info", "warning", "error", "fatal", "panic",
};

View File

@ -44,7 +44,7 @@
int name_mask(NAME_MASK *table, const char *names)
{
char *myname = "name_mask";
const char *myname = "name_mask";
char *saved_names = mystrdup(names);
char *bp = saved_names;
int result = 0;

View File

@ -39,7 +39,7 @@
int sane_link(const char *from, const char *to)
{
char *myname = "sane_link";
const char *myname = "sane_link";
int saved_errno;
struct stat from_st;
struct stat to_st;

View File

@ -39,7 +39,7 @@
int sane_rename(const char *from, const char *to)
{
char *myname = "sane_rename";
const char *myname = "sane_rename";
int saved_errno;
struct stat st;

View File

@ -117,7 +117,7 @@ char *scan_dir_path(SCAN_DIR *scan)
void scan_dir_push(SCAN_DIR *scan, const char *path)
{
char *myname = "scan_dir_push";
const char *myname = "scan_dir_push";
SCAN_INFO *info;
info = (SCAN_INFO *) mymalloc(sizeof(*info));
@ -137,7 +137,7 @@ void scan_dir_push(SCAN_DIR *scan, const char *path)
SCAN_DIR *scan_dir_pop(SCAN_DIR *scan)
{
char *myname = "scan_dir_pop";
const char *myname = "scan_dir_pop";
SCAN_INFO *info = scan->current;
SCAN_INFO *parent;
@ -170,7 +170,7 @@ SCAN_DIR *scan_dir_open(const char *path)
char *scan_dir_next(SCAN_DIR *scan)
{
char *myname = "scan_dir_next";
const char *myname = "scan_dir_next";
SCAN_INFO *info = scan->current;
struct dirent *dp;

View File

@ -113,7 +113,7 @@ struct spawn_args {
static void get_spawn_args(struct spawn_args * args, int init_key, va_list ap)
{
char *myname = "get_spawn_args";
const char *myname = "get_spawn_args";
int key;
/*
@ -186,7 +186,7 @@ static void get_spawn_args(struct spawn_args * args, int init_key, va_list ap)
WAIT_STATUS_T spawn_command(int key,...)
{
char *myname = "spawn_comand";
const char *myname = "spawn_comand";
va_list ap;
pid_t pid;
WAIT_STATUS_T wait_status;

View File

@ -62,7 +62,7 @@
int stream_connect(const char *path, int block_mode, int unused_timeout)
{
#ifdef STREAM_CONNECTIONS
char *myname = "stream_connect";
const char *myname = "stream_connect";
int pair[2];
int fifo;

View File

@ -57,7 +57,7 @@
int stream_trigger(const char *service, const char *buf, int len, int timeout)
{
char *myname = "stream_trigger";
const char *myname = "stream_trigger";
int fd;
if (msg_verbose > 1)

View File

@ -80,7 +80,7 @@ static void timed_wait_alarm(int unused_sig)
int timed_waitpid(pid_t pid, WAIT_STATUS_T *statusp, int options,
int time_limit)
{
char *myname = "timed_waitpid";
const char *myname = "timed_waitpid";
struct sigaction action;
struct sigaction old_action;
int time_left;

View File

@ -57,7 +57,7 @@
int unix_trigger(const char *service, const char *buf, int len, int timeout)
{
char *myname = "unix_trigger";
const char *myname = "unix_trigger";
int fd;
if (msg_verbose > 1)

View File

@ -52,7 +52,7 @@
int valid_hostname(const char *name)
{
char *myname = "valid_hostname";
const char *myname = "valid_hostname";
const char *cp;
int label_length = 0;
int label_count = 0;
@ -116,7 +116,7 @@ int valid_hostname(const char *name)
int valid_hostaddr(const char *addr)
{
const char *cp;
char *myname = "valid_hostaddr";
const char *myname = "valid_hostaddr";
int in_byte = 0;
int byte_count = 0;
int byte_val = 0;

View File

@ -402,7 +402,7 @@ static void vstream_buf_init(VBUF *bp, int flags)
static void vstream_buf_alloc(VBUF *bp, int len)
{
int used = bp->ptr - bp->data;
char *myname = "vstream_buf_alloc";
const char *myname = "vstream_buf_alloc";
if (len < bp->len)
msg_panic("%s: attempt to shrink buffer", myname);
@ -436,7 +436,7 @@ static void vstream_buf_wipe(VBUF *bp)
static int vstream_fflush_some(VSTREAM *stream, int to_flush)
{
char *myname = "vstream_fflush_some";
const char *myname = "vstream_fflush_some";
VBUF *bp = &stream->buf;
int used;
int left_over;
@ -544,7 +544,7 @@ static int vstream_fflush_delayed(VSTREAM *stream)
static int vstream_buf_get_ready(VBUF *bp)
{
VSTREAM *stream = VBUF_TO_APPL(bp, VSTREAM, buf);
char *myname = "vstream_buf_get_ready";
const char *myname = "vstream_buf_get_ready";
int n;
/*
@ -630,7 +630,7 @@ static int vstream_buf_get_ready(VBUF *bp)
static int vstream_buf_put_ready(VBUF *bp)
{
VSTREAM *stream = VBUF_TO_APPL(bp, VSTREAM, buf);
char *myname = "vstream_buf_put_ready";
const char *myname = "vstream_buf_put_ready";
/*
* Sanity checks. Detect a change of I/O direction or position. If so,
@ -677,7 +677,7 @@ static int vstream_buf_space(VBUF *bp, int want)
int used;
int incr;
int shortage;
char *myname = "vstream_buf_space";
const char *myname = "vstream_buf_space";
/*
* Sanity checks. Reserving space implies writing. It is illegal to write
@ -730,7 +730,7 @@ static int vstream_buf_space(VBUF *bp, int want)
long vstream_fseek(VSTREAM *stream, long offset, int whence)
{
char *myname = "vstream_fseek";
const char *myname = "vstream_fseek";
VBUF *bp = &stream->buf;
/*
@ -953,7 +953,7 @@ int vstream_fputs(const char *str, VSTREAM *stream)
void vstream_control(VSTREAM *stream, int name,...)
{
char *myname = "vstream_control";
const char *myname = "vstream_control";
va_list ap;
for (va_start(ap, name); name != VSTREAM_CTL_END; name = va_arg(ap, int)) {

View File

@ -126,7 +126,7 @@ typedef struct VSTREAM_POPEN_ARGS {
static VSTREAM *vstream_parse_args(VSTREAM_POPEN_ARGS *args, va_list ap)
{
char *myname = "vstream_parse_args";
const char *myname = "vstream_parse_args";
int key;
/*
@ -190,7 +190,7 @@ static VSTREAM *vstream_parse_args(VSTREAM_POPEN_ARGS *args, va_list ap)
VSTREAM *vstream_popen_vargs(int flags,...)
{
char *myname = "vstream_popen_vargs";
const char *myname = "vstream_popen_vargs";
VSTREAM_POPEN_ARGS args;
va_list ap;
VSTREAM *stream;

View File

@ -117,7 +117,7 @@ static WATCHDOG *watchdog_curr;
static void watchdog_event(int unused_sig)
{
char *myname = "watchdog_event";
const char *myname = "watchdog_event";
WATCHDOG *wp;
/*
@ -143,7 +143,7 @@ static void watchdog_event(int unused_sig)
WATCHDOG *watchdog_create(unsigned timeout, WATCHDOG_FN action, char *context)
{
char *myname = "watchdog_create";
const char *myname = "watchdog_create";
struct sigaction sig_action;
WATCHDOG *wp;
@ -172,7 +172,7 @@ WATCHDOG *watchdog_create(unsigned timeout, WATCHDOG_FN action, char *context)
void watchdog_destroy(WATCHDOG *wp)
{
char *myname = "watchdog_destroy";
const char *myname = "watchdog_destroy";
watchdog_stop(wp);
watchdog_curr = wp->saved_watchdog;
@ -189,7 +189,7 @@ void watchdog_destroy(WATCHDOG *wp)
void watchdog_start(WATCHDOG *wp)
{
char *myname = "watchdog_start";
const char *myname = "watchdog_start";
if (wp != watchdog_curr)
msg_panic("%s: wrong watchdog instance", myname);
@ -203,7 +203,7 @@ void watchdog_start(WATCHDOG *wp)
void watchdog_stop(WATCHDOG *wp)
{
char *myname = "watchdog_stop";
const char *myname = "watchdog_stop";
if (wp != watchdog_curr)
msg_panic("%s: wrong watchdog instance", myname);