summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <[email protected]>2012-03-01 00:36:16 -0500
committerVictor Kareh <[email protected]>2018-08-28 18:44:15 -0400
commit9b6f737a66009e139fcf6979fbbdbad33746df80 (patch)
treea68696c9e4206bbb833b0e88292c9c50e963a5b2
parent48b0b11dcd18737135a01b48f355c2cb74b3fd6a (diff)
downloadmarco-9b6f737a66009e139fcf6979fbbdbad33746df80.tar.bz2
marco-9b6f737a66009e139fcf6979fbbdbad33746df80.tar.xz
theme: Replace char array element comparisons with strncmp
https://bugzilla.gnome.org/show_bug.cgi?id=662962
-rw-r--r--src/ui/theme.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 8016da6b..913ae885 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -1164,10 +1164,8 @@ meta_color_spec_new_from_string (const char *str,
MetaColorSpec *spec;
spec = NULL;
-
- if (str[0] == 'g' && str[1] == 't' && str[2] == 'k' && str[3] == ':' &&
- str[4] == 'c' && str[5] == 'u' && str[6] == 's' && str[7] == 't' &&
- str[8] == 'o' && str[9] == 'm')
+
+ if (strncmp (str, "gtk:custom", 10) == 0)
{
const char *color_name_start, *fallback_str_start, *end;
char *color_name;
@@ -1241,7 +1239,7 @@ meta_color_spec_new_from_string (const char *str,
spec->data.gtkcustom.color_name = color_name;
spec->data.gtkcustom.fallback = fallback;
}
- else if (str[0] == 'g' && str[1] == 't' && str[2] == 'k' && str[3] == ':')
+ else if (strncmp (str, "gtk:", 4) == 0)
{
/* GTK color */
const char *bracket;
@@ -1308,8 +1306,7 @@ meta_color_spec_new_from_string (const char *str,
spec->data.gtk.component = component;
g_assert (spec->data.gtk.component < META_GTK_COLOR_LAST);
}
- else if (str[0] == 'b' && str[1] == 'l' && str[2] == 'e' && str[3] == 'n' &&
- str[4] == 'd' && str[5] == '/')
+ else if (strncmp (str, "blend/", 6) == 0)
{
/* blend */
char **split;
@@ -1377,8 +1374,7 @@ meta_color_spec_new_from_string (const char *str,
spec->data.blend.background = bg;
spec->data.blend.foreground = fg;
}
- else if (str[0] == 's' && str[1] == 'h' && str[2] == 'a' && str[3] == 'd' &&
- str[4] == 'e' && str[5] == '/')
+ else if (strncmp (str, "shade/", 6) == 0)
{
/* shade */
char **split;
@@ -1717,20 +1713,12 @@ op_from_string (const char *p,
return POS_OP_MOD;
case '`':
- if (p[0] == '`' &&
- p[1] == 'm' &&
- p[2] == 'a' &&
- p[3] == 'x' &&
- p[4] == '`')
+ if (strncmp (p, "`max`", 5) == 0)
{
*len = 5;
return POS_OP_MAX;
}
- else if (p[0] == '`' &&
- p[1] == 'm' &&
- p[2] == 'i' &&
- p[3] == 'n' &&
- p[4] == '`')
+ else if (strncmp (p, "`min`", 5) == 0)
{
*len = 5;
return POS_OP_MIN;