daemon: mark some strings as const
None of these strings is modified; marking them as const will help later refactoring. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jun 18, 2014 at 15:41 UTC
1055a890f04784d7ea7cdaca8d30479e685d8643
1 file changed
+7
-7
daemon.c
+7
-7
@@ -39,8 +39,8 @@ static int strict_paths;
39
static int export_all_trees;
40
41
/* Take all paths relative to this one if non-NULL */
42
-static char *base_path;
43
-static char *interpolated_path;
42
+static const char *base_path;
43
+static const char *interpolated_path;
44
static int base_path_relaxed;
45
46
/* Flag indicating client sent extra args. */
@@ -106,12 +106,12 @@ static void NORETURN daemon_die(const char *err, va_list params)
106
exit(1);
107
}
108
109
-static const char *path_ok(char *directory)
109
+static const char *path_ok(const char *directory)
110
{
111
static char rpath[PATH_MAX];
112
static char interp_path[PATH_MAX];
113
const char *path;
114
- char *dir;
114
+ const char *dir;
115
116
dir = directory;
117
@@ -131,7 +131,7 @@ static const char *path_ok(char *directory)
131
* "~alice/%s/foo".
132
*/
133
int namlen, restlen = strlen(dir);
134
- char *slash = strchr(dir, '/');
134
+ const char *slash = strchr(dir, '/');
135
if (!slash)
136
slash = dir + restlen;
137
namlen = slash - dir;
@@ -253,7 +253,7 @@ static int daemon_error(const char *dir, const char *msg)
253
return -1;
254
}
255
256
-static char *access_hook;
256
+static const char *access_hook;
257
258
static int run_access_hook(struct daemon_service *service, const char *dir, const char *path)
259
{
@@ -318,7 +318,7 @@ error_return:
318
return -1;
319
}
320
321
-static int run_service(char *dir, struct daemon_service *service)
321
+static int run_service(const char *dir, struct daemon_service *service)
322
{
323
const char *path;
324
int enabled = service->enabled;