Browse Source

[core] (const char *) for srvconf.modules_dir

no need to be allocated (buffer *)
master
Glenn Strauss 5 months ago
parent
commit
10b307bd00
  1. 2
      src/base.h
  2. 3
      src/configfile.c
  3. 4
      src/plugin.c
  4. 4
      src/server.c

2
src/base.h

@ -116,8 +116,8 @@ typedef struct {
const buffer *network_backend;
const array *feature_flags;
const char *event_handler;
const char *modules_dir;
buffer *pid_file;
buffer *modules_dir;
array *modules;
array *config_touched;
array empty_array;

3
src/configfile.c

@ -1448,7 +1448,6 @@ void config_free(server *srv) {
array_free(srv->config_context);
array_free(srv->srvconf.config_touched);
array_free(srv->srvconf.modules);
buffer_free(srv->srvconf.modules_dir);
array_free(srv->srvconf.upload_tempdirs);
#ifdef HAVE_PCRE2_H
if (NULL == srv->match_data) pcre2_match_data_free(srv->match_data);
@ -1479,7 +1478,7 @@ void config_init(server *srv) {
| HTTP_PARSEOPT_URL_NORMALIZE_PATH_DOTSEG_REMOVE;
srv->srvconf.modules = array_init(16);
srv->srvconf.modules_dir = buffer_init_string(LIBRARY_DIR);
srv->srvconf.modules_dir = LIBRARY_DIR;
srv->srvconf.upload_tempdirs = array_init(2);
}

4
src/plugin.c

@ -165,8 +165,8 @@ int plugins_load(server *srv) {
for (uint32_t i = 0; i < srv->srvconf.modules->used; ++i) {
const buffer * const module = &((data_string *)srv->srvconf.modules->data[i])->value;
buffer_copy_path_len2(tb, BUF_PTR_LEN(srv->srvconf.modules_dir),
BUF_PTR_LEN(module));
buffer_copy_string(tb, srv->srvconf.modules_dir);
buffer_append_path_len(tb, BUF_PTR_LEN(module));
#if defined(__WIN32) || defined(__CYGWIN__)
buffer_append_string_len(tb, CONST_STR_LEN(".dll"));
#else

4
src/server.c

@ -1110,7 +1110,7 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
}
break;
case 'm':
buffer_copy_string(srv->srvconf.modules_dir, optarg);
srv->srvconf.modules_dir = optarg;
break;
case 'i': {
char *endptr;
@ -1145,7 +1145,7 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
return -1;
}
srv->srvconf.dont_daemonize = 1;
buffer_copy_string_len(srv->srvconf.modules_dir, CONST_STR_LEN("modules"));
srv->srvconf.modules_dir = "modules";
if (config_read(srv, "conf/lighttpd.conf")) return -1;
}
#endif

Loading…
Cancel
Save