summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4ec34bc)
raw | patch | inline | side by side (parent: 4ec34bc)
author | Kalle Wallin <kaw@linux.se> | |
Mon, 29 Mar 2004 18:15:45 +0000 (18:15 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Mon, 29 Mar 2004 18:15:45 +0000 (18:15 +0000) |
support.c | patch | blob | history | |
support.h | patch | blob | history |
diff --git a/support.c b/support.c
index 488b4cc532f84a6f6bf864f4dabcc95f2520fb91..becd60b3156718208515ef354f336bc6717f5f71 100644 (file)
--- a/support.c
+++ b/support.c
}
-char *
-concat_path(char *p1, char *p2)
-{
- size_t size;
- char *path;
- char append_slash = 0;
-
- size = strlen(p1);
- if( size==0 || p1[size-1]!='/' )
- {
- size++;
- append_slash = 1;
- }
- size += strlen(p2);
- size++;
-
- path = g_malloc0(size*sizeof(char));
- g_strlcpy(path, p1, size);
- if( append_slash )
- g_strlcat(path, "/", size);
- g_strlcat(path, p2, size);
-
- return path;
-}
-
-
-
#ifndef HAVE_BASENAME
char *
basename(char *path)
}
char *
-utf8_to_locale(char *str)
+utf8_to_locale(char *utf8str)
{
+ char *str;
+
if( noconvert )
- return g_strdup(str);
- return g_locale_from_utf8(str, -1, NULL, NULL, NULL);
+ return g_strdup(utf8str);
+ if( (str=g_locale_from_utf8(utf8str, -1, NULL, NULL, NULL)) == NULL )
+ return g_strdup(utf8str);
+ return str;
}
char *
-locale_to_utf8(char *str)
+locale_to_utf8(char *localestr)
{
+ char *str;
+
if( noconvert )
- return g_strdup(str);
- return g_locale_to_utf8(str, -1, NULL, NULL, NULL);
+ return g_strdup(localestr);
+ if( (str=g_locale_to_utf8(localestr, -1, NULL, NULL, NULL)) == NULL )
+ return g_strdup(localestr);
+ return str;
}
diff --git a/support.h b/support.h
index adba8a05dbd7a9a404696da199546969d266b7d1..f94936ce5bb8fbf07dd34047996518d35281b660 100644 (file)
--- a/support.h
+++ b/support.h
#include <libgen.h>
#endif
-char *concat_path(char *p1, char *p2);
-
#ifndef HAVE_BASENAME
char *basename(char *path);
#endif