From 9495aa9923fed16aeb6f49c69ccd249b9e17dba7 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 15 Feb 2008 14:57:48 +0100 Subject: Using cString::sprintf() instead of asprintf() --- plugin.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'plugin.c') diff --git a/plugin.c b/plugin.c index a39453cd..9193125e 100644 --- a/plugin.c +++ b/plugin.c @@ -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 : ""); - 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); } -- cgit v1.2.3