Use (std) bool instead of custom bool types

OAI is riddled with boolean_t, FALSE, TRUE, etc. This makes no sense, as
there is a standard bool type, and could lead to nasty bugs if a
definition of a bool is non-standard (0 == false, true == !false). This
commit removes all non-standard bools in the whole project.
This commit is contained in:
Robert Schmidt
2022-06-27 10:07:48 +02:00
parent 6d030ea2fa
commit 0b91791f67
176 changed files with 1414 additions and 1573 deletions
-21
View File
@@ -43,27 +43,6 @@ Description Contains global common definitions
#include <stddef.h>
#include <stdbool.h>
/* boolean_t is also defined in openair2/COMMON/platform_types.h
* let's protect potential redefinition
*/
#ifndef _BOOLEAN_T_DEFINED_
#define _BOOLEAN_T_DEFINED_
typedef signed char boolean_t;
#if !defined(TRUE)
#define TRUE (boolean_t)0x01
#endif
#if !defined(FALSE)
#define FALSE (boolean_t)0x00
#endif
#define BOOL_NOT(b) (b^TRUE)
#endif /* _BOOLEAN_T_DEFINED_ */
#define NAS_UE_ID_FMT "0x%06x"
/****************************************************************************/
+1 -1
View File
@@ -145,7 +145,7 @@ struct mac_tx_tb_management {
struct mac_rx_tb_management {
unsigned char *data_ptr;
tb_size_t tb_size; // in bits
boolean_t valid_checksum;
bool valid_checksum;
unsigned char first_bit; // 0 if data starts on byte boundary(b7), 1 if b6, 2 if b5, etc
};
+19 -42
View File
@@ -32,35 +32,12 @@
#if !defined(NAS_NETLINK)
#include <stdint.h>
#include <stdbool.h>
#else
#include <linux/types.h>
typedef void * intptr_t;
#endif
//-----------------------------------------------------------------------------
// GENERIC TYPES
//-----------------------------------------------------------------------------
/* boolean_t is also defined in openair2/COMMON/commonDef.h,
* let's protect potential redefinition
*/
#ifndef _BOOLEAN_T_DEFINED_
#define _BOOLEAN_T_DEFINED_
typedef signed char boolean_t;
#if !defined(TRUE)
#define TRUE (boolean_t)0x01
#endif
#if !defined(FALSE)
#define FALSE (boolean_t)0x00
#endif
#define BOOL_NOT(b) (b^TRUE)
#endif /* _BOOLEAN_T_DEFINED_ */
//-----------------------------------------------------------------------------
// GENERIC ACCESS STRATUM TYPES
//-----------------------------------------------------------------------------
@@ -77,25 +54,25 @@ typedef int16_t smodule_id_t;
typedef long rb_id_t;
typedef long srb_id_t;
typedef boolean_t MBMS_flag_t;
#define MBMS_FLAG_NO FALSE
#define MBMS_FLAG_YES TRUE
typedef bool MBMS_flag_t;
#define MBMS_FLAG_NO false
#define MBMS_FLAG_YES true
typedef boolean_t eNB_flag_t;
#define ENB_FLAG_NO FALSE
#define ENB_FLAG_YES TRUE
typedef bool eNB_flag_t;
#define ENB_FLAG_NO false
#define ENB_FLAG_YES true
typedef boolean_t gNB_flag_t;
#define GNB_FLAG_NO FALSE
#define GNB_FLAG_YES TRUE
typedef bool gNB_flag_t;
#define GNB_FLAG_NO false
#define GNB_FLAG_YES true
typedef boolean_t srb_flag_t;
#define SRB_FLAG_NO FALSE
#define SRB_FLAG_YES TRUE
typedef bool srb_flag_t;
#define SRB_FLAG_NO false
#define SRB_FLAG_YES true
typedef boolean_t sl_discovery_flag_t;
#define SL_DISCOVERY_FLAG_NO FALSE
#define SL_DISCOVERY_FLAG_YES TRUE
typedef bool sl_discovery_flag_t;
#define SL_DISCOVERY_FLAG_NO false
#define SL_DISCOVERY_FLAG_YES true
typedef enum link_direction_e {
UNKNOWN_DIR = 0,
@@ -152,8 +129,8 @@ typedef uint16_t rlc_usn_t;
typedef int32_t rlc_buffer_occupancy_t;
typedef signed int rlc_op_status_t;
#define SDU_CONFIRM_NO FALSE
#define SDU_CONFIRM_YES TRUE
#define SDU_CONFIRM_NO false
#define SDU_CONFIRM_YES true
//-----------------------------------------------------------------------------
// PDCP TYPES
//-----------------------------------------------------------------------------
@@ -242,7 +219,7 @@ typedef struct protocol_ctxt_s {
frame_t frame; /*!< \brief LTE frame number.*/
sub_frame_t subframe; /*!< \brief LTE sub frame number.*/
eNB_index_t eNB_index; /*!< \brief valid for UE indicating the index of connected eNB(s) */
boolean_t brOption;
bool brOption;
} protocol_ctxt_t;
// warning time hardcoded
#define PROTOCOL_CTXT_TIME_MILLI_SECONDS(CtXt_h) ((CtXt_h)->frame*10+(CtXt_h)->subframe)