# HG changeset patch # User Mikael Berthe # Date 1190317266 -7200 # Node ID 248e3f69dd9e4bdc484439ae6eeeba63186701a9 # Parent d1d12a09b04ab631049a49a47803a2c1f7985382 Fix a bug in the nick_colors variable parsing diff -r d1d12a09b04a -r 248e3f69dd9e mcabber/src/screen.c --- a/mcabber/src/screen.c Thu Sep 20 20:08:59 2007 +0200 +++ b/mcabber/src/screen.c Thu Sep 20 21:41:06 2007 +0200 @@ -517,31 +517,31 @@ COLOR_ATTRIB[i] = A_BOLD; } if (!nickcols) { - char *ncolors = g_strdup(settings_opt_get("nick_colors")), - *ncolor_start = ncolors; + char *ncolors = g_strdup(settings_opt_get("nick_colors")); if (ncolors) { - while (*ncolors) { + char *ncolor_start, *ncolor_end; + ncolor_start = ncolor_end = ncolors; + + while (*ncolor_end) + ncolor_end++; + + while (ncolors < ncolor_end && *ncolors) { if ((*ncolors == ' ') || (*ncolors == '\t')) { - ncolors ++; + ncolors++; } else { char *end = ncolors; - bool ended = false; + int cl; while (*end && (*end != ' ') && (*end != '\t')) end++; - if (!end) - ended = true; *end = '\0'; - int cl = get_user_color(ncolors); + cl = get_user_color(ncolors); if (cl < 0) { scr_LogPrint(LPRINT_NORMAL, "Unknown color %s", ncolors); } else { nickcols = g_realloc(nickcols, (++nickcolcount) * sizeof *nickcols); nickcols[nickcolcount-1] = cl; } - if (ended) - ncolors = NULL; - else - ncolors = end+1; + ncolors = end+1; } } g_free(ncolor_start);