Mercurial > audlegacy-plugins
comparison src/streambrowser/xiph.c @ 2894:630c9662e0f1
No, no, no and no. "type identifier[variable]" is NOT a proper way to
allocate tables (or strings, for that matter).
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 13 Aug 2008 01:57:40 +0300 |
parents | c27da2c06805 |
children | 92fc55b8da15 |
comparison
equal
deleted
inserted
replaced
2893:6a6f27de82aa | 2894:630c9662e0f1 |
---|---|
224 debug("xiph: streaming directory successfuly loaded\n"); | 224 debug("xiph: streaming directory successfuly loaded\n"); |
225 } | 225 } |
226 | 226 |
227 static gboolean genre_match(gchar *string1, gchar *string2) | 227 static gboolean genre_match(gchar *string1, gchar *string2) |
228 { | 228 { |
229 char *saveptr = NULL; | 229 gchar *saveptr = NULL, *token; |
230 char *token; | |
231 gboolean matched = FALSE; | 230 gboolean matched = FALSE; |
232 char temp1[strlen(string1) + 1]; | 231 gchar *temp1 = g_strdup(string1), |
233 char temp2[strlen(string2) + 1]; | 232 *temp2 = g_strdup(string2); |
234 | 233 |
235 /* these are required for strtok_r to work properly */ | |
236 strcpy(temp1, string1); | |
237 strcpy(temp2, string2); | |
238 | |
239 token = strtok_r(temp1, " ", &saveptr); | 234 token = strtok_r(temp1, " ", &saveptr); |
240 while (token != NULL) { | 235 while (token != NULL) { |
241 if (mystrcasestr(temp2, token)) | 236 if (mystrcasestr(temp2, token)) |
242 matched = TRUE; | 237 matched = TRUE; |
243 | 238 |
244 token = strtok_r(NULL, " ", &saveptr); | 239 token = strtok_r(NULL, " ", &saveptr); |
245 } | 240 } |
246 | 241 |
247 return matched; | 242 return matched; |
248 } | 243 } |