diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2008-02-15 14:57:48 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2008-02-15 14:57:48 +0100 |
commit | 9495aa9923fed16aeb6f49c69ccd249b9e17dba7 (patch) | |
tree | 5bf8b7683e3bf3b6e0725adf834b0d5344283ad3 /plugin.c | |
parent | c8584521f794492d81d87d448f2c4dcefc636b34 (diff) | |
download | vdr-9495aa9923fed16aeb6f49c69ccd249b9e17dba7.tar.gz vdr-9495aa9923fed16aeb6f49c69ccd249b9e17dba7.tar.bz2 |
Using cString::sprintf() instead of asprintf()
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); } |