Use a consistent definition of bool

Since _Bool is only ever a keyword and not a macro, and we can't
test for HAVE_STDBOOL_H in the headers, remove the #ifdef for it in
<cdio/types.h> and instead, simply define it as 'int'.  Replace
inclusion of <stdbool.h> with <cdio/types.h> so that a consistent
definition of bool is used.

Signed-off-by: Natalia Portillo <claunia@claunia.com>
This commit is contained in:
Stuart Brady
2012-04-30 23:30:57 +01:00
committed by Natalia Portillo
parent 634bf0ad6b
commit 4fe14a678b
7 changed files with 15 additions and 42 deletions

View File

@@ -104,24 +104,15 @@ typedef uint8_t ubyte;
#endif #endif
#ifndef __cplusplus #ifndef __cplusplus
# if defined(HAVE_STDBOOL_H)
/* All the stdbool.h seem to define those */ # include <stdbool.h>
#ifndef __bool_true_false_are_defined # else
#define __bool_true_false_are_defined 1 /* ISO/IEC 9899:1999 <stdbool.h> missing -- enabling workaround */
#undef bool # define false 0
#undef true # define true 1
#undef false # define bool uint8_t
# endif /*HAVE_STDBOOL_H*/
#ifdef _Bool
#define bool _Bool
#else
#define bool int
#endif
#define true 1
#define false 0
#endif /* __bool_true_false_are_defined */
#endif /*C++*/ #endif /*C++*/
/* some GCC optimizations -- gcc 2.5+ */ /* some GCC optimizations -- gcc 2.5+ */

View File

@@ -25,11 +25,8 @@
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/types.h>
#include "cdio_assert.h" #include "cdio_assert.h"
#include "cdio_private.h" #include "cdio_private.h"

View File

@@ -24,13 +24,10 @@
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/types.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include <cdio/logging.h> #include <cdio/logging.h>
#include "cdio_assert.h" #include "cdio_assert.h"

View File

@@ -20,10 +20,6 @@
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
@@ -31,6 +27,7 @@
#include <cdio/logging.h> #include <cdio/logging.h>
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/types.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include "cdio_assert.h" #include "cdio_assert.h"
#include "cdio_private.h" #include "cdio_private.h"

View File

@@ -45,12 +45,9 @@
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/types.h>
#include "cdio_assert.h" #include "cdio_assert.h"
#include "cdio_private.h" #include "cdio_private.h"

View File

@@ -24,13 +24,10 @@
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/types.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include <cdio/logging.h> #include <cdio/logging.h>
#include "cdio_assert.h" #include "cdio_assert.h"

View File

@@ -32,13 +32,10 @@
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif
#include <cdio/logging.h> #include <cdio/logging.h>
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/types.h>
/* For SCSI TR_* enumerations */ /* For SCSI TR_* enumerations */
typedef enum { typedef enum {