Mercurial > hg
changeset 1314:248e3f69dd9e
Fix a bug in the nick_colors variable parsing
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 20 Sep 2007 21:41:06 +0200 |
parents | d1d12a09b04a |
children | 18f1f82303ce |
files | mcabber/src/screen.c |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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);