Merge branch 'ebassi/c99-boolean-constants' into 'main'

Alias TRUE and FALSE to C99's true and false

Closes #3326

See merge request GNOME/glib!4001
This commit is contained in:
Philip Withnall 2024-05-16 12:50:08 +00:00
commit 4d2e0df9ee
2 changed files with 7 additions and 4 deletions

View File

@ -39,6 +39,9 @@
*/
#include <stddef.h>
/* We include stdbool.h to get the system's definition of true and false */
#include <stdbool.h>
/*
* Note: Clang (but not clang-cl) defines __GNUC__ and __GNUC_MINOR__.
* Both Clang 11.1 on current Arch Linux and Apple's Clang 12.0 define
@ -922,11 +925,11 @@
#endif
#ifndef FALSE
#define FALSE (0)
#define FALSE false
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#define TRUE true
#endif
#undef MAX

View File

@ -56,7 +56,7 @@ typedef struct
gpointer arg_data;
union
{
gboolean bool;
gboolean boolean;
gint integer;
gchar *str;
gchar **array;
@ -1585,7 +1585,7 @@ free_changes_list (GOptionContext *context,
switch (change->arg_type)
{
case G_OPTION_ARG_NONE:
*(gboolean *)change->arg_data = change->prev.bool;
*(gboolean *)change->arg_data = change->prev.boolean;
break;
case G_OPTION_ARG_INT:
*(gint *)change->arg_data = change->prev.integer;