changeset 269:dca6c0b9f862

Simplify layout_color_name_parse() using g_strdelimit().
author zas_
date Tue, 08 Apr 2008 14:52:42 +0000
parents 98268a6b8182
children 67db7e4505c6
files src/layout.c
diffstat 1 files changed, 2 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout.c	Tue Apr 08 14:50:14 2008 +0000
+++ b/src/layout.c	Tue Apr 08 14:52:42 2008 +0000
@@ -366,19 +366,8 @@
 
 static gchar *layout_color_name_parse(const gchar *name)
 {
-	gchar *result;
-	gchar *p;
-
-	if (!name) name = _("Empty");
-
-	result = g_strdup(name);
-	p = result;
-	while (*p != '\0')
-		{
-		if (*p == '_') *p = '-';
-		p++;
-		}
-	return result;
+	if (!name) return g_strdup(_("Empty"));
+	return g_strdelimit(g_strdup(name), "_", '-');
 }
 
 static void layout_color_button_press_cb(GtkWidget *widget, gpointer data)