mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 08:28:53 +02:00
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.
This commit is contained in:
@@ -107,6 +107,12 @@ enum_state_add_value (EnumState *state,
|
|||||||
return;
|
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)))
|
if (state->is_flags && (value & (value - 1)))
|
||||||
{
|
{
|
||||||
g_set_error (error, G_MARKUP_ERROR,
|
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.
|
* If we loosen the one-bit-set restriction we need an overlap check.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
strinfo_builder_append_item (state->strinfo, nick, value);
|
strinfo_builder_append_item (state->strinfo, nick, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user