Replace bool as boolean instead of int in libgm2

This patch tidies KeyBoardLEDs.cc, RTco.cc, sckt.cc
and wrapc.cc by removing the TRUE/FALSE macros and using
bool, true and false.

libgm2/ChangeLog:

	* libm2cor/KeyBoardLEDs.cc (TRUE): Remove.
	(FALSE): Remove.
	(init): Replace TRUE with true.
	* libm2iso/RTco.cc (TRUE): Remove.
	(FALSE): Remove.
	(initSem): Replace int with bool.
	(init): Replace FALSE with false.
	* libm2pim/sckt.cc (TRUE): Remove.
	(FALSE): Remove.
	* libm2pim/wrapc.cc: Replace TRUE with true
	and FALSE with false.
	(FALSE): Remove.
	(TRUE): Remove.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
This commit is contained in:
Gaius Mulley 2023-05-13 15:49:50 +01:00
parent 8b18714fbb
commit 2415442489
4 changed files with 14 additions and 42 deletions

View File

@ -40,17 +40,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <sys/ioctl.h>
#include <stdio.h>
#if !defined(TRUE)
# define TRUE (1==1)
#endif
#if !defined(FALSE)
# define FALSE (1==0)
#endif
#include <stdlib.h>
static int fd;
static int initialized = FALSE;
static bool initialized = false;
extern "C" void
@ -102,7 +95,7 @@ M2EXPORT(init) (int, char **, char **)
{
if (! initialized)
{
initialized = TRUE;
initialized = true;
fd = open ("/dev/tty", O_RDONLY);
if (fd == -1)
{

View File

@ -61,14 +61,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define gm2_printf __printf__
#endif
#if !defined(TRUE)
#define TRUE (1 == 1)
#endif
#if !defined(FALSE)
#define FALSE (1 == 0)
#endif
#if defined(TRACEON)
#define tprintf printf
#else
@ -92,7 +84,7 @@ typedef struct threadCB_s
typedef struct threadSem_s
{
__gthread_cond_t counter;
int waiting;
bool waiting;
int sem_value;
} threadSem;
@ -104,7 +96,7 @@ static threadSem **semArray = NULL;
/* These are used to lock the above module data structures. */
static __gthread_mutex_t lock; /* This is the only mutex for
the whole module. */
static int initialized = FALSE;
static int initialized = false;
extern "C" int EXPORT(init) (void);
@ -128,7 +120,7 @@ static void
initSem (threadSem *sem, int value)
{
__GTHREAD_COND_INIT_FUNCTION (&sem->counter);
sem->waiting = FALSE;
sem->waiting = false;
sem->sem_value = value;
}
@ -138,9 +130,9 @@ waitSem (threadSem *sem)
__gthread_mutex_lock (&lock);
if (sem->sem_value == 0)
{
sem->waiting = TRUE;
sem->waiting = true;
__gthread_cond_wait (&sem->counter, &lock);
sem->waiting = FALSE;
sem->waiting = false;
}
else
sem->sem_value--;
@ -495,7 +487,7 @@ EXPORT(init) (void)
tprintf ("checking init\n");
if (! initialized)
{
initialized = TRUE;
initialized = true;
tprintf ("RTco initialized\n");
__GTHREAD_MUTEX_INIT_FUNCTION (&lock);

View File

@ -85,13 +85,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#undef DEBUGGING
#if !defined(TRUE)
#define TRUE (1 == 1)
#endif
#if !defined(FALSE)
#define FALSE (1 == 0)
#endif
#if defined(HAVE_SYS_SOCKET_H)
#define ERROR(X) \

View File

@ -59,12 +59,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <time.h>
#endif
/* Define FALSE if one hasn't already been defined. */
#if !defined(FALSE)
#define FALSE (1 == 0)
#endif
/* Define a generic NULL if one hasn't already been defined. */
#if !defined(NULL)
@ -214,7 +208,7 @@ EXPORT(signbit) (double r)
sizeof(double). */
return signbit (r);
#else
return FALSE;
return false;
#endif
}
@ -227,7 +221,7 @@ EXPORT(signbitl) (long double r)
sizeof(double). */
return signbitl (r);
#else
return FALSE;
return false;
#endif
}
@ -240,7 +234,7 @@ EXPORT(signbitf) (float r)
sizeof(double). */
return signbitf (r);
#else
return FALSE;
return false;
#endif
}
@ -253,7 +247,7 @@ EXPORT(isfinite) (double x)
#if defined(FP_NAN) && defined(FP_INFINITE)
return (fpclassify (x) != FP_NAN && fpclassify (x) != FP_INFINITE);
#else
return FALSE;
return false;
#endif
}
@ -266,7 +260,7 @@ EXPORT(isfinitel) (long double x)
#if defined(FP_NAN) && defined(FP_INFINITE)
return (fpclassify (x) != FP_NAN && fpclassify (x) != FP_INFINITE);
#else
return FALSE;
return false;
#endif
}
@ -279,7 +273,7 @@ EXPORT(isfinitef) (float x)
#if defined(FP_NAN) && defined(FP_INFINITE)
return (fpclassify (x) != FP_NAN && fpclassify (x) != FP_INFINITE);
#else
return FALSE;
return false;
#endif
}