aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-22 10:29:15 +0000
committerRoy Marples <roy@marples.name>2008-01-22 10:29:15 +0000
commitb4bff9ce5efce83a7265a42d4372d367ca32f696 (patch)
tree5b15b4a0a8d270365e1032c969febbbe34be5a26 /src
parente5baa6ad378a6cf7ddc7689163adfd8719d9946f (diff)
Quiet some lint warnings.
Diffstat (limited to 'src')
-rw-r--r--src/includes/rc-misc.h8
-rw-r--r--src/librc/librc-daemon.c34
-rw-r--r--src/librc/librc-misc.c8
-rw-r--r--src/librc/librc.c10
4 files changed, 33 insertions, 27 deletions
diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h
index 62d35c46..e034c1e5 100644
--- a/src/includes/rc-misc.h
+++ b/src/includes/rc-misc.h
@@ -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
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index e5fb2d53..a972bd7a 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -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 {
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c
index db6209fd..329525cf 100644
--- a/src/librc/librc-misc.c
+++ b/src/librc/librc-misc.c
@@ -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);
}
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 38961b75..7093ddab 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -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);