diff options
Diffstat (limited to 'plugin.c')
-rw-r--r-- | plugin.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: plugin.c 1.26 2007/08/05 12:48:50 kls Exp $ + * $Id: plugin.c 1.27 2008/02/10 16:05:46 kls Exp $ */ #include "plugin.h" @@ -142,11 +142,10 @@ void cPlugin::SetConfigDirectory(const char *Dir) const char *cPlugin::ConfigDirectory(const char *PluginName) { - static char *buffer = NULL; + static cString buffer; if (!cThread::IsMainThread()) esyslog("ERROR: plugin '%s' called cPlugin::ConfigDirectory(), which is not thread safe!", PluginName ? PluginName : "<no name given>"); - free(buffer); - asprintf(&buffer, "%s/plugins%s%s", configDirectory, PluginName ? "/" : "", PluginName ? PluginName : ""); + buffer = cString::sprintf("%s/plugins%s%s", configDirectory, PluginName ? "/" : "", PluginName ? PluginName : ""); return MakeDirs(buffer, true) ? buffer : NULL; } @@ -317,10 +316,7 @@ void cPluginManager::AddPlugin(const char *Args) char *p = strchr(s, ' '); if (p) *p = 0; - char *buffer = NULL; - asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION); - dlls.Add(new cDll(buffer, Args)); - free(buffer); + dlls.Add(new cDll(cString::sprintf("%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION), Args)); free(s); } |