From 8c7736fc1ad24bafcc178e4363cc49a1c4e57494 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Mon, 29 Mar 2004 18:15:45 +0000 Subject: [PATCH] Removed the concat_path() function. git-svn-id: https://svn.musicpd.org/ncmpc/trunk@540 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- support.c | 47 ++++++++++++++--------------------------------- support.h | 2 -- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/support.c b/support.c index 488b4cc..becd60b 100644 --- a/support.c +++ b/support.c @@ -70,33 +70,6 @@ lowerstr(char *str) } -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) @@ -155,19 +128,27 @@ charset_close(void) } 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 adba8a0..f94936c 100644 --- a/support.h +++ b/support.h @@ -3,8 +3,6 @@ #include #endif -char *concat_path(char *p1, char *p2); - #ifndef HAVE_BASENAME char *basename(char *path); #endif -- 2.30.2