gtksourceview r2210 - in branches/indenters: . gtksourceview
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gtksourceview r2210 - in branches/indenters: . gtksourceview
- Date: Sun, 8 Mar 2009 11:34:00 +0000 (UTC)
Author: icq
Date: Sun Mar 8 11:34:00 2009
New Revision: 2210
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=2210&view=rev
Log:
2009-03-08 Ignacio Casal Quinteiro <nacho resa gmail com>
* gtksourceview/c-indenter.c:
Do not reinvent the wheel when checking case labels.
Modified:
branches/indenters/ChangeLog
branches/indenters/gtksourceview/c-indenter.c
Modified: branches/indenters/gtksourceview/c-indenter.c
==============================================================================
--- branches/indenters/gtksourceview/c-indenter.c (original)
+++ branches/indenters/gtksourceview/c-indenter.c Sun Mar 8 11:34:00 2009
@@ -96,44 +96,11 @@
static gboolean
is_caselabel (const gchar *label)
{
- const gchar *case_label[] =
- {
- "case",
- "default",
- NULL
- };
gboolean is_case = FALSE;
- gchar *p;
- gunichar c;
- gint i = 0;
- gint j;
- p = (gchar *)label;
- c = g_utf8_get_char (p);
-
- while (case_label[i] != NULL && !is_case)
- {
- const gchar *word = case_label[i];
- j = 0;
-
- while (word[j] != '\0' && word[j] == c)
- {
- p = g_utf8_next_char (p);
- c = g_utf8_get_char (p);
- j++;
- }
-
- if (word[j] == '\0')
- {
- is_case = TRUE;
- }
- else
- {
- is_case = FALSE;
- }
-
- i++;
- }
+ if (g_str_has_prefix (label, "case") ||
+ g_str_has_prefix (label, "default"))
+ is_case = TRUE;
return is_case;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]