From: Matt Birkholz Date: Sun, 2 Jul 2017 23:40:20 +0000 (-0700) Subject: glib plugin: fix per new random warning. X-Git-Tag: mit-scheme-pucked-9.2.12~112 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=83892fd9bbb0d6391caba74e66d5aaebc6310d6d;p=mit-scheme.git glib plugin: fix per new random warning. --- diff --git a/src/glib/glibio.c b/src/glib/glibio.c index ae5eb0a54..9ae154903 100644 --- a/src/glib/glibio.c +++ b/src/glib/glibio.c @@ -455,17 +455,19 @@ gpollfds_string (GSList * gpollfds) /* Construct a string describing the fds and r/w flags in GPOLLFDS, e.g. " 0(r)" */ - gchar * string = ""; + gchar * string = NULL; GSList * scan = gpollfds; while (scan != NULL) { GPollFD * gfd = scan->data; int mode = (gfd->events) & (~(G_IO_HUP|G_IO_ERR)); - gchar * next = g_strdup_printf ("%s %d(%s)", string, gfd->fd, - (mode == (G_IO_IN|G_IO_OUT) ? "rw" - : mode == G_IO_IN ? "r" - : mode == G_IO_OUT ? "w" : "?")); - if (string[0] != '\0') + gchar * next = g_strdup_printf ("%s %d(%s)", + (string == NULL ? "" : string), + gfd->fd, + (mode == (G_IO_IN|G_IO_OUT) ? "rw" + : mode == G_IO_IN ? "r" + : mode == G_IO_OUT ? "w" : "?")); + if (string != NULL) g_free (string); string = next; scan = scan->next;