diff options
author | Roy Marples <roy@marples.name> | 2008-03-17 13:25:56 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-03-17 13:25:56 +0000 |
commit | 4c1466642351ddb01cc7353601153a79326f18f7 (patch) | |
tree | cb9da1a90aa9480ef276626f40c556379222ec51 /src/rc/rc-plugin.c | |
parent | 50a7697bf207e4919ce893bfc1604fd3a9d807de (diff) |
Punt the rc_strcatpaths function and use snprintf instead to save on expensive malloc calls.
Diffstat (limited to 'src/rc/rc-plugin.c')
-rw-r--r-- | src/rc/rc-plugin.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rc/rc-plugin.c b/src/rc/rc-plugin.c index f0ee5a61..034f79d2 100644 --- a/src/rc/rc-plugin.c +++ b/src/rc/rc-plugin.c @@ -79,7 +79,7 @@ void rc_plugin_load(void) DIR *dp; struct dirent *d; PLUGIN *plugin; - char *p; + char file[PATH_MAX]; void *h; int (*fptr)(RC_HOOK, const char *); @@ -96,9 +96,8 @@ void rc_plugin_load(void) if (d->d_name[0] == '.') continue; - p = rc_strcatpaths(RC_PLUGINDIR, d->d_name, NULL); - h = dlopen(p, RTLD_LAZY); - free(p); + snprintf(file, sizeof(file), RC_PLUGINDIR "/%s", d->d_name); + h = dlopen(file, RTLD_LAZY); if (! h) { eerror("dlopen: %s", dlerror()); continue; |