From 9d2cb4518c3a8a72ccc714ddbc131aaa84506092 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 10 Nov 2010 00:10:22 +0100 Subject: Decouple settings handling from old-style plugins The breakage was discovered when i removed Logger class. it turned out the fix is somewhat involved. This change implements it as discussed with the rest of the team. Signed-off-by: Denys Vlasenko --- lib/utils/Makefile.am | 1 + lib/utils/Plugin.cpp | 15 --------------- lib/utils/overlapping_strcpy.c | 22 ++++++++++++++++++++++ 3 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 lib/utils/overlapping_strcpy.c (limited to 'lib/utils') diff --git a/lib/utils/Makefile.am b/lib/utils/Makefile.am index 129feeb5..37508ee7 100644 --- a/lib/utils/Makefile.am +++ b/lib/utils/Makefile.am @@ -16,6 +16,7 @@ libABRTUtils_la_SOURCES = \ xfuncs.c \ concat_path_file.c \ append_to_malloced_string.c \ + overlapping_strcpy.c \ encbase64.c \ stdio_helpers.c \ hash_md5.c hash_md5.h \ diff --git a/lib/utils/Plugin.cpp b/lib/utils/Plugin.cpp index 8c00e609..bf237959 100644 --- a/lib/utils/Plugin.cpp +++ b/lib/utils/Plugin.cpp @@ -40,21 +40,6 @@ void CPlugin::SetSettings(const map_plugin_settings_t& pSettings) } } -const map_plugin_settings_t& CPlugin::GetSettings() -{ - VERB3 - { - log("GetSettings:"); - map_plugin_settings_t::const_iterator it = m_pSettings.begin(); - while (it != m_pSettings.end()) - { - log(" settings[%s]:'%s'", it->first.c_str(), it->second.c_str()); - it++; - } - } - return m_pSettings; -} - bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings, bool skipKeysWithoutValue /*= true*/) { diff --git a/lib/utils/overlapping_strcpy.c b/lib/utils/overlapping_strcpy.c new file mode 100644 index 00000000..41c1c1a1 --- /dev/null +++ b/lib/utils/overlapping_strcpy.c @@ -0,0 +1,22 @@ +/* + * Copyright (C) 1999-2004 by Erik Andersen + * + * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. + */ +#include "abrtlib.h" + +/* Like strcpy but can copy overlapping strings. */ +void overlapping_strcpy(char *dst, const char *src) +{ + /* Cheap optimization for dst == src case - + * better to have it here than in many callers. + */ + if (dst != src) + { + while ((*dst = *src) != '\0') + { + dst++; + src++; + } + } +} -- cgit