[glib] schema compiler: Don't store zero-valued flags
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] schema compiler: Don't store zero-valued flags
- Date: Mon, 4 Oct 2010 06:58:29 +0000 (UTC)
commit 833e389516b5e5b2271ed84c7b2036801c3100f1
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Oct 4 02:57:06 2010 -0400
schema compiler: Don't store zero-valued flags
Don't store the "none" value for flags into the compiled schema file.
"none" should never appear as a value -- no flags set is indicated by an
empty array.
gio/glib-compile-schemas.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c
index 2c97261..f5e8d1c 100644
--- a/gio/glib-compile-schemas.c
+++ b/gio/glib-compile-schemas.c
@@ -107,6 +107,12 @@ enum_state_add_value (EnumState *state,
return;
}
+ /* Silently drop the null case if it is mentioned.
+ * It is properly denoted with an empty array.
+ */
+ if (state->is_flags && value == 0)
+ return;
+
if (state->is_flags && (value & (value - 1)))
{
g_set_error (error, G_MARKUP_ERROR,
@@ -121,7 +127,6 @@ enum_state_add_value (EnumState *state,
* If we loosen the one-bit-set restriction we need an overlap check.
*/
-
strinfo_builder_append_item (state->strinfo, nick, value);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]