# HG changeset patch # User Matti Hamalainen # Date 1103120583 0 # Node ID df4cb5115322a98d3dea33b202bfe2325071e7a6 # Parent 16e3b2446a73c1ce97e581eaac857cc034f2c4c7 Removed duplicate function, more portability cleanups. diff -r 16e3b2446a73 -r df4cb5115322 src/xs_config.c --- a/src/xs_config.c Wed Dec 15 14:18:00 2004 +0000 +++ b/src/xs_config.c Wed Dec 15 14:23:03 2004 +0000 @@ -213,11 +213,11 @@ xs_cfg.playMinTime = 15; xs_cfg.songlenDBEnable = FALSE; - xs_strcalloc(&xs_cfg.songlenDBPath, "~/C64Music/Songlengths.txt"); + xs_pstrcpy(&xs_cfg.songlenDBPath, "~/C64Music/Songlengths.txt"); xs_cfg.stilDBEnable = FALSE; - xs_strcalloc(&xs_cfg.stilDBPath, "~/C64Music/DOCUMENTS/STIL.txt"); - xs_strcalloc(&xs_cfg.hvscPath, "~/C64Music"); + xs_pstrcpy(&xs_cfg.stilDBPath, "~/C64Music/DOCUMENTS/STIL.txt"); + xs_pstrcpy(&xs_cfg.hvscPath, "~/C64Music"); #ifdef HAVE_SONG_POSITION xs_cfg.subsongControl = XS_SSC_PATCH; @@ -232,7 +232,7 @@ #else xs_cfg.titleOverride = TRUE; #endif - xs_strcalloc(&xs_cfg.titleFormat, "%p - %t (%c) [%n]"); + xs_pstrcpy(&xs_cfg.titleFormat, "%p - %t (%c) [%n]"); /* Try to open the XMMS configuration file */ @@ -272,7 +272,7 @@ if (xmms_cfg_read_string(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, (gchar **) &tmpStr)) { /* Read was successfull */ - xs_strcalloc((gchar **) xs_cfgtable[i].itemData, tmpStr); + xs_pstrcpy((gchar **) xs_cfgtable[i].itemData, tmpStr); g_free(tmpStr); } break; @@ -428,7 +428,7 @@ case WTYPE_TEXT: /* Get text from text-widget */ - xs_strcalloc((gchar **) xs_widtable[i].itemData, + xs_pstrcpy((gchar **) xs_widtable[i].itemData, gtk_entry_get_text(GTK_ENTRY(LUW(xs_widtable[i].widName))) ); break; diff -r 16e3b2446a73 -r df4cb5115322 src/xs_stil.c --- a/src/xs_stil.c Wed Dec 15 14:18:00 2004 +0000 +++ b/src/xs_stil.c Wed Dec 15 14:23:03 2004 +0000 @@ -91,28 +91,6 @@ } } -gint xs_strmcat(gchar **ppResult, gchar *pStr) -{ - assert(ppResult); - - /* Check the string pointers */ - if (!pStr) return -1; - - if (*ppResult != NULL) - { - *ppResult = (gchar *) g_realloc(*ppResult, strlen(*ppResult) + strlen(pStr) + 1); - if (*ppResult == NULL) return -1; - strcat(*ppResult, pStr); - } else - { - *ppResult = (gchar *) g_malloc(strlen(pStr) + 1); - if (*ppResult == NULL) return -1; - strcpy(*ppResult, pStr); - } - - return 0; -} - /* * Read database to memory @@ -232,19 +210,19 @@ { inLine[eolPos++] = '\n'; inLine[eolPos++] = 0; - xs_strmcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[2]); + xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[2]); } else if (strncmp(inLine, " ARTIST:", 8) == 0) { inLine[eolPos++] = '\n'; inLine[eolPos++] = 0; - xs_strmcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[1]); + xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[1]); } else if (strncmp(inLine, "COMMENT:", 8) == 0) - xs_strmcat(&(tmpNode->subTune[subEntry].pInfo), inLine); + xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), inLine); else if (strncmp(inLine, " ", 8) == 0) - xs_strmcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[8]); + xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[8]); break; } diff -r 16e3b2446a73 -r df4cb5115322 src/xs_support.c --- a/src/xs_support.c Wed Dec 15 14:18:00 2004 +0000 +++ b/src/xs_support.c Wed Dec 15 14:23:03 2004 +0000 @@ -21,7 +21,7 @@ */ #include "xmms-sid.h" #include "xs_support.h" - +#include /* Copy a string */ @@ -75,15 +75,13 @@ if (*ppResult != NULL) { - *ppResult = g_realloc(*ppResult, strlen(*ppResult) + strlen(pStr) + 1); + *ppResult = (gchar *) g_realloc(*ppResult, strlen(*ppResult) + strlen(pStr) + 1); if (*ppResult == NULL) return -1; - strcat(*ppResult, pStr); } else { - *ppResult = g_malloc(strlen(pStr) + 1); + *ppResult = (gchar *) g_malloc(strlen(pStr) + 1); if (*ppResult == NULL) return -1; - strcpy(*ppResult, pStr); }