aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-12-20 15:02:04 +0000
committerRoy Marples <roy@marples.name>2007-12-20 15:02:04 +0000
commitc474b810af3a04659be23a745535d612d9f6db4d (patch)
tree71bb64c7f8afbe583b8758cf4fdca56e2c6cafe1
parent6b37d16a2250e80808ec0b6efa9aa4afeb46a6c3 (diff)
Constant data and pointers
-rw-r--r--src/librc-depend.c29
-rw-r--r--src/rc.c4
-rw-r--r--src/rc.h9
-rw-r--r--src/runscript.c16
4 files changed, 32 insertions, 26 deletions
diff --git a/src/librc-depend.c b/src/librc-depend.c
index a8e03bb0..902d012f 100644
--- a/src/librc-depend.c
+++ b/src/librc-depend.c
@@ -88,21 +88,23 @@ void rc_deptree_free (rc_depinfo_t *deptree)
}
librc_hidden_def(rc_deptree_free)
-static rc_depinfo_t *get_depinfo (rc_depinfo_t *deptree, const char *service)
+static rc_depinfo_t *get_depinfo (const rc_depinfo_t *deptree,
+ const char *service)
{
- rc_depinfo_t *di;
+ const rc_depinfo_t *di;
if (! deptree || ! service)
return (NULL);
for (di = deptree; di; di = di->next)
if (strcmp (di->service, service) == 0)
- return (di);
+ return ((rc_depinfo_t *)di);
return (NULL);
}
-static rc_deptype_t *get_deptype (rc_depinfo_t *depinfo, const char *type)
+static rc_deptype_t *get_deptype (const rc_depinfo_t *depinfo,
+ const char *type)
{
rc_deptype_t *dt;
@@ -270,7 +272,8 @@ static bool get_provided1 (const char *runlevel, struct lhead *providers,
If there are any bugs in rc-depend, they will probably be here as
provided dependancy can change depending on runlevel state.
*/
-static char **get_provided (rc_depinfo_t *deptree, rc_depinfo_t *depinfo,
+static char **get_provided (const rc_depinfo_t *deptree,
+ const rc_depinfo_t *depinfo,
const char *runlevel, int options)
{
rc_deptype_t *dt;
@@ -376,9 +379,10 @@ static char **get_provided (rc_depinfo_t *deptree, rc_depinfo_t *depinfo,
return (providers.list);
}
-static void visit_service (rc_depinfo_t *deptree, const char * const *types,
+static void visit_service (const rc_depinfo_t *deptree,
+ const char * const *types,
struct lhead *sorted, struct lhead *visited,
- rc_depinfo_t *depinfo,
+ const rc_depinfo_t *depinfo,
const char *runlevel, int options)
{
int i, j, k;
@@ -466,7 +470,7 @@ static void visit_service (rc_depinfo_t *deptree, const char * const *types,
rc_strlist_add (&sorted->list, depinfo->service);
}
-char **rc_deptree_depend (rc_depinfo_t *deptree,
+char **rc_deptree_depend (const rc_depinfo_t *deptree,
const char *service, const char *type)
{
rc_depinfo_t *di;
@@ -490,8 +494,9 @@ char **rc_deptree_depend (rc_depinfo_t *deptree,
}
librc_hidden_def(rc_deptree_depend)
-char **rc_deptree_depends (rc_depinfo_t *deptree,
- const char **types, const char **services,
+char **rc_deptree_depends (const rc_depinfo_t *deptree,
+ const char *const *types,
+ const char *const *services,
const char *runlevel, int options)
{
struct lhead sorted;
@@ -526,8 +531,8 @@ char **rc_deptree_depends (rc_depinfo_t *deptree,
}
librc_hidden_def(rc_deptree_depends)
-static const const char *order_types[] = { "ineed", "iuse", "iafter", NULL };
-char **rc_deptree_order (rc_depinfo_t *deptree, const char *runlevel,
+static const char * const order_types[] = { "ineed", "iuse", "iafter", NULL };
+char **rc_deptree_order (const rc_depinfo_t *deptree, const char *runlevel,
int options)
{
char **list = NULL;
diff --git a/src/rc.c b/src/rc.c
index 1bf706bc..a733db0b 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -109,8 +109,8 @@ typedef struct pidlist
} pidlist_t;
static pidlist_t *service_pids = NULL;
-static const char *types_n[] = { "needsme", NULL };
-static const char *types_nua[] = { "ineed", "iuse", "iafter", NULL };
+static const char *const types_n[] = { "needsme", NULL };
+static const char *const types_nua[] = { "ineed", "iuse", "iafter", NULL };
static void cleanup (void)
{
diff --git a/src/rc.h b/src/rc.h
index b95c9c5d..0020764e 100644
--- a/src/rc.h
+++ b/src/rc.h
@@ -274,7 +274,7 @@ rc_depinfo_t *rc_deptree_load (void);
* @param type to use (keywords, etc)
* @param service to check
* @return NULL terminated list of services in order */
-char **rc_deptree_depend (rc_depinfo_t *deptree,
+char **rc_deptree_depend (const rc_depinfo_t *deptree,
const char *type, const char *service);
/*! List all the services in order that the given services have
@@ -284,8 +284,9 @@ char **rc_deptree_depend (rc_depinfo_t *deptree,
* @param services to check
* @param options to pass
* @return NULL terminated list of services in order */
-char **rc_deptree_depends (rc_depinfo_t *deptree, const char **types,
- const char **services, const char *runlevel,
+char **rc_deptree_depends (const rc_depinfo_t *deptree,
+ const char *const *types,
+ const char *const *services, const char *runlevel,
int options);
/*! List all the services that should be stoppned and then started, in order,
@@ -295,7 +296,7 @@ char **rc_deptree_depends (rc_depinfo_t *deptree, const char **types,
* @param runlevel to change into
* @param options to pass
* @return NULL terminated list of services in order */
-char **rc_deptree_order (rc_depinfo_t *deptree, const char *runlevel,
+char **rc_deptree_order (const rc_depinfo_t *deptree, const char *runlevel,
int options);
/*! Free a deptree and its information
diff --git a/src/runscript.c b/src/runscript.c
index 5c4a2a5e..aed254d3 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -99,13 +99,13 @@ static int master_tty = -1;
extern char **environ;
-static const char *types_b[] = { "broken", NULL };
-static const char *types_n[] = { "ineed", NULL };
-static const char *types_nu[] = { "ineed", "iuse", NULL };
-static const char *types_nua[] = { "ineed", "iuse", "iafter", NULL };
+static const char *const types_b[] = { "broken", NULL };
+static const char *const types_n[] = { "ineed", NULL };
+static const char *const types_nu[] = { "ineed", "iuse", NULL };
+static const char *const types_nua[] = { "ineed", "iuse", "iafter", NULL };
-static const char *types_m[] = { "needsme", NULL };
-static const char *types_mua[] = { "needsme", "usesme", "beforeme", NULL };
+static const char *const types_m[] = { "needsme", NULL };
+static const char *const types_mua[] = { "needsme", "usesme", "beforeme", NULL };
#ifdef __linux__
static void (*selinux_run_init_old) (void);
@@ -637,7 +637,7 @@ static void svc_start (bool deps)
int i;
int j;
int depoptions = RC_DEP_TRACE;
- const char *svcl[] = { applet, NULL };
+ const char *const svcl[] = { applet, NULL };
rc_service_state_t state;
state = rc_service_state (service);
@@ -846,7 +846,7 @@ static void svc_start (bool deps)
static void svc_stop (bool deps)
{
bool stopped;
- const char *svcl[] = { applet, NULL };
+ const char *const svcl[] = { applet, NULL };
rc_service_state_t state = rc_service_state (service);