Quiet some lint warnings.

This commit is contained in:
Roy Marples 2008-01-22 10:29:15 +00:00
parent e5baa6ad37
commit b4bff9ce5e
4 changed files with 33 additions and 27 deletions

View File

@ -65,8 +65,11 @@
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
#ifdef lint
# define _unused
#endif
#if __GNUC__ > 2 || defined(__INTEL_COMPILER)
# define _unused __attribute__((__unused__))
#endif
@ -79,6 +82,7 @@ _unused static void *xmalloc (size_t size)
return (value);
ERRX;
/* NOTREACHED */
}
_unused static void *xrealloc (void *ptr, size_t size)
@ -89,6 +93,7 @@ _unused static void *xrealloc (void *ptr, size_t size)
return (value);
ERRX;
/* NOTREACHED */
}
_unused static char *xstrdup (const char *str)
@ -104,6 +109,7 @@ _unused static char *xstrdup (const char *str)
return (value);
ERRX;
/* NOTREACHED */
}
#undef ERRX

View File

@ -309,7 +309,7 @@ bool rc_service_daemon_set (const char *service, const char *exec,
{
char *dirpath;
char *file = NULL;
int i;
size_t l;
char *mexec;
char *mname;
char *mpidfile;
@ -328,23 +328,23 @@ bool rc_service_daemon_set (const char *service, const char *exec,
basename_c (service), (char *) NULL);
if (exec) {
i = strlen (exec) + 6;
mexec = xmalloc (sizeof (char) * i);
snprintf (mexec, i, "exec=%s", exec);
l = strlen (exec) + 6;
mexec = xmalloc (sizeof (char) * l);
snprintf (mexec, l, "exec=%s", exec);
} else
mexec = xstrdup ("exec=");
if (name) {
i = strlen (name) + 6;
mname = xmalloc (sizeof (char) * i);
snprintf (mname, i, "name=%s", name);
l = strlen (name) + 6;
mname = xmalloc (sizeof (char) * l);
snprintf (mname, l, "name=%s", name);
} else
mname = xstrdup ("name=");
if (pidfile) {
i = strlen (pidfile) + 9;
mpidfile = xmalloc (sizeof (char) * i);
snprintf (mpidfile, i, "pidfile=%s", pidfile);
l = strlen (pidfile) + 9;
mpidfile = xmalloc (sizeof (char) * l);
snprintf (mpidfile, l, "pidfile=%s", pidfile);
} else
mpidfile = xstrdup ("pidfile=");
@ -406,7 +406,7 @@ bool rc_service_started_daemon (const char *service, const char *exec,
{
char *dirpath;
char *file;
int i;
size_t l;
char *mexec;
bool retval = false;
DIR *dp;
@ -418,14 +418,14 @@ bool rc_service_started_daemon (const char *service, const char *exec,
dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename_c (service),
(char *) NULL);
i = strlen (exec) + 6;
mexec = xmalloc (sizeof (char) * i);
snprintf (mexec, i, "exec=%s", exec);
l = strlen (exec) + 6;
mexec = xmalloc (sizeof (char) * l);
snprintf (mexec, l, "exec=%s", exec);
if (indx > 0) {
int len = sizeof (char) * 10;
file = xmalloc (len);
snprintf (file, len, "%03d", indx);
l = sizeof (char) * 10;
file = xmalloc (l);
snprintf (file, l, "%03d", indx);
retval = _match_daemon (dirpath, file, mexec, NULL, NULL);
free (file);
} else {

View File

@ -57,8 +57,8 @@ librc_hidden_def(rc_yesno)
char *rc_strcatpaths (const char *path1, const char *paths, ...)
{
va_list ap;
int length;
int i;
size_t length;
size_t i;
char *p;
char *path;
char *pathp;
@ -176,7 +176,7 @@ char **rc_config_load (const char *file)
char *line;
char *linep;
char *linetok;
int i = 0;
size_t i = 0;
int j;
bool replaced;
char *entry;
@ -251,7 +251,7 @@ char *rc_config_value (const char *const *list, const char *entry)
STRLIST_FOREACH (list, line, i) {
p = strchr (line, '=');
if (p && strncmp (entry, line, p - line) == 0)
if (p && strncmp (entry, line, (size_t) (p - line)) == 0)
return (p += 1);
}

View File

@ -309,7 +309,7 @@ char **rc_service_extra_commands (const char *service)
char *token;
char *p;
FILE *fp;
int l;
size_t l;
if (! (svc = rc_service_resolve (service)))
return (NULL);
@ -337,7 +337,7 @@ char *rc_service_description (const char *service, const char *option)
char *cmd;
char *desc = NULL;
FILE *fp;
int i;
size_t l;
if (! (svc = rc_service_resolve (service)))
return (NULL);
@ -345,9 +345,9 @@ char *rc_service_description (const char *service, const char *option)
if (! option)
option = "";
i = strlen (DESCSTR) + strlen (svc) + strlen (option) + 2;
cmd = xmalloc (sizeof (char) * i);
snprintf (cmd, i, DESCSTR, svc, option ? "_" : "", option);
l = strlen (DESCSTR) + strlen (svc) + strlen (option) + 2;
cmd = xmalloc (sizeof (char) * l);
snprintf (cmd, l, DESCSTR, svc, option ? "_" : "", option);
free (svc);
if ((fp = popen (cmd, "r"))) {
desc = rc_getline (fp);