summaryrefslogtreecommitdiffstats
path: root/lib/Utils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-02 11:58:01 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-02 11:58:01 +0100
commit68e616def90ece3bdde925dc106e51e8560fa05d (patch)
tree9b6c258dcacf7b2a7d7f38d16cee0a7f9c338fc0 /lib/Utils
parent0586639caf9fd8218257a16006bb9783ee490102 (diff)
downloadabrt-68e616def90ece3bdde925dc106e51e8560fa05d.tar.gz
abrt-68e616def90ece3bdde925dc106e51e8560fa05d.tar.xz
abrt-68e616def90ece3bdde925dc106e51e8560fa05d.zip
lib/Plugins/CCpp: respect DebugInfoCacheMB setting
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils')
-rw-r--r--lib/Utils/DebugDump.cpp11
-rw-r--r--lib/Utils/xfuncs.cpp34
2 files changed, 34 insertions, 11 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index 5017d86..f5c7319 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -29,17 +29,6 @@
#include "ABRTException.h"
#include "CommLayerInner.h"
-/* Is it "." or ".."? */
-/* abrtlib candidate */
-static bool dot_or_dotdot(const char *filename)
-{
- if (filename[0] != '.') return false;
- if (filename[1] == '\0') return true;
- if (filename[1] != '.') return false;
- if (filename[2] == '\0') return true;
- return false;
-}
-
static bool isdigit_str(const char *str)
{
do
diff --git a/lib/Utils/xfuncs.cpp b/lib/Utils/xfuncs.cpp
index 9c8b0f1..533fbfa 100644
--- a/lib/Utils/xfuncs.cpp
+++ b/lib/Utils/xfuncs.cpp
@@ -321,3 +321,37 @@ int is_regular_file(struct dirent *dent, const char *dirname)
return r == 0 && S_ISREG(statbuf.st_mode);
}
+
+/* Is it "." or ".."? */
+/* abrtlib candidate */
+bool dot_or_dotdot(const char *filename)
+{
+ if (filename[0] != '.') return false;
+ if (filename[1] == '\0') return true;
+ if (filename[1] != '.') return false;
+ if (filename[2] == '\0') return true;
+ return false;
+}
+
+/* Find out if the last character of a string matches the one given.
+ * Don't underrun the buffer if the string length is 0.
+ */
+char *last_char_is(const char *s, int c)
+{
+ if (s && *s) {
+ s += strlen(s) - 1;
+ if ((unsigned char)*s == c)
+ return (char*)s;
+ }
+ return NULL;
+}
+
+std::string concat_path_file(const char *path, const char *filename)
+{
+ char *lc;
+
+ while (*filename == '/')
+ filename++;
+ lc = last_char_is(path, '/');
+ return ssprintf("%s%s%s", path, (lc==NULL ? "/" : ""), filename);
+}