comparison src/xs_stil.c @ 224:df4cb5115322

Removed duplicate function, more portability cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 15 Dec 2004 14:23:03 +0000
parents 16e3b2446a73
children 92bad4c7b998
comparison
equal deleted inserted replaced
223:16e3b2446a73 224:df4cb5115322
87 } else { 87 } else {
88 xs_stildb = pNode; /* First node ... */ 88 xs_stildb = pNode; /* First node ... */
89 LPREV = pNode; /* ... it's also last */ 89 LPREV = pNode; /* ... it's also last */
90 LNEXT = NULL; /* But next is NULL! */ 90 LNEXT = NULL; /* But next is NULL! */
91 } 91 }
92 }
93
94 gint xs_strmcat(gchar **ppResult, gchar *pStr)
95 {
96 assert(ppResult);
97
98 /* Check the string pointers */
99 if (!pStr) return -1;
100
101 if (*ppResult != NULL)
102 {
103 *ppResult = (gchar *) g_realloc(*ppResult, strlen(*ppResult) + strlen(pStr) + 1);
104 if (*ppResult == NULL) return -1;
105 strcat(*ppResult, pStr);
106 } else
107 {
108 *ppResult = (gchar *) g_malloc(strlen(pStr) + 1);
109 if (*ppResult == NULL) return -1;
110 strcpy(*ppResult, pStr);
111 }
112
113 return 0;
114 } 92 }
115 93
116 94
117 /* 95 /*
118 * Read database to memory 96 * Read database to memory
230 } else 208 } else
231 if (strncmp(inLine, " TITLE:", 8) == 0) 209 if (strncmp(inLine, " TITLE:", 8) == 0)
232 { 210 {
233 inLine[eolPos++] = '\n'; 211 inLine[eolPos++] = '\n';
234 inLine[eolPos++] = 0; 212 inLine[eolPos++] = 0;
235 xs_strmcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[2]); 213 xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[2]);
236 } else 214 } else
237 if (strncmp(inLine, " ARTIST:", 8) == 0) 215 if (strncmp(inLine, " ARTIST:", 8) == 0)
238 { 216 {
239 inLine[eolPos++] = '\n'; 217 inLine[eolPos++] = '\n';
240 inLine[eolPos++] = 0; 218 inLine[eolPos++] = 0;
241 xs_strmcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[1]); 219 xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[1]);
242 } else 220 } else
243 if (strncmp(inLine, "COMMENT:", 8) == 0) 221 if (strncmp(inLine, "COMMENT:", 8) == 0)
244 xs_strmcat(&(tmpNode->subTune[subEntry].pInfo), inLine); 222 xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), inLine);
245 else 223 else
246 if (strncmp(inLine, " ", 8) == 0) 224 if (strncmp(inLine, " ", 8) == 0)
247 xs_strmcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[8]); 225 xs_pstrcat(&(tmpNode->subTune[subEntry].pInfo), &inLine[8]);
248 break; 226 break;
249 } 227 }
250 228
251 } /* while */ 229 } /* while */
252 230