diff --git a/include/modules.h b/include/modules.h index b0a92dd3..66356234 100644 --- a/include/modules.h +++ b/include/modules.h @@ -52,11 +52,6 @@ struct module void * mapi_header; /* actually struct mapi_mheader_av */ }; -struct module_path -{ - char path[PATH_MAX]; -}; - #define MAPI_MAGIC_HDR 0x4D410000 #define MAPI_V1 (MAPI_MAGIC_HDR | 0x1) diff --git a/src/modules.c b/src/modules.c index 692c14fa..00797e95 100644 --- a/src/modules.c +++ b/src/modules.c @@ -130,17 +130,17 @@ modules_init(void) * output - none * side effects - returns a module path from path */ -static struct module_path * +static char * mod_find_path(const char *path) { rb_dlink_node *ptr; - struct module_path *mpath; + char *mpath; RB_DLINK_FOREACH(ptr, mod_paths.head) { mpath = ptr->data; - if(!strcmp(path, mpath->path)) + if(!strcmp(path, mpath)) return mpath; } @@ -156,14 +156,12 @@ mod_find_path(const char *path) void mod_add_path(const char *path) { - struct module_path *pathst; + char *pathst; if(mod_find_path(path)) return; - pathst = rb_malloc(sizeof(struct module_path)); - - strcpy(pathst->path, path); + pathst = rb_strdup(path); rb_dlinkAddAlloc(pathst, &mod_paths); } @@ -288,7 +286,7 @@ load_one_module(const char *path, int coremodule) { char modpath[PATH_MAX]; rb_dlink_node *pathst; - struct module_path *mpath; + const char *mpath; struct stat statbuf; @@ -299,7 +297,7 @@ load_one_module(const char *path, int coremodule) { mpath = pathst->data; - rb_snprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path); + rb_snprintf(modpath, sizeof(modpath), "%s/%s", mpath, path); if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL)) { if(stat(modpath, &statbuf) == 0)