Detect stdbool.h and add conformant shims if it isn't available
Charybdis requires C99 already, so it's high time we start using stdbool. I've converted a few pieces of code already. A lot of the old code that uses YES/NO should probably be updated too because that's fucking hideous.
This commit is contained in:
parent
b3b7401f13
commit
07554369bd
12 changed files with 34 additions and 23 deletions
|
@ -120,6 +120,7 @@ AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IR
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
AC_HEADER_STDBOOL
|
||||||
|
|
||||||
AC_CHECK_HEADERS([crypt.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h sys/wait.h wait.h sys/epoll.h sys/uio.h machine/endian.h])
|
AC_CHECK_HEADERS([crypt.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h sys/wait.h wait.h sys/epoll.h sys/uio.h machine/endian.h])
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#define MAXMODEPARAMS 4
|
#define MAXMODEPARAMS 4
|
||||||
#define MAXMODEPARAMSSERV 10
|
#define MAXMODEPARAMSSERV 10
|
||||||
|
|
||||||
|
#include <setup.h>
|
||||||
|
|
||||||
struct Client;
|
struct Client;
|
||||||
|
|
||||||
/* mode structure for channels */
|
/* mode structure for channels */
|
||||||
|
@ -258,7 +260,7 @@ void resv_chan_forcepart(const char *name, const char *reason, int temp_time);
|
||||||
extern void set_channel_mode(struct Client *client_p, struct Client *source_p,
|
extern void set_channel_mode(struct Client *client_p, struct Client *source_p,
|
||||||
struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]);
|
struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]);
|
||||||
extern void set_channel_mlock(struct Client *client_p, struct Client *source_p,
|
extern void set_channel_mlock(struct Client *client_p, struct Client *source_p,
|
||||||
struct Channel *chptr, const char *newmlock, int propagate);
|
struct Channel *chptr, const char *newmlock, bool propagate);
|
||||||
|
|
||||||
extern struct ChannelMode chmode_table[256];
|
extern struct ChannelMode chmode_table[256];
|
||||||
|
|
||||||
|
|
|
@ -30,17 +30,6 @@
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TRUE
|
|
||||||
#undef TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FALSE
|
|
||||||
#undef FALSE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FALSE 0
|
|
||||||
#define TRUE 1
|
|
||||||
#define HIDEME 2
|
|
||||||
|
|
||||||
/* Blah. I use these a lot. -Dianora */
|
/* Blah. I use these a lot. -Dianora */
|
||||||
#ifdef YES
|
#ifdef YES
|
||||||
|
|
|
@ -169,6 +169,9 @@
|
||||||
/* Define to 1 if you have the `socketpair' function. */
|
/* Define to 1 if you have the `socketpair' function. */
|
||||||
#undef HAVE_SOCKETPAIR
|
#undef HAVE_SOCKETPAIR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||||
|
#undef HAVE_STDBOOL_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <stddef.h> header file. */
|
/* Define to 1 if you have the <stddef.h> header file. */
|
||||||
#undef HAVE_STDDEF_H
|
#undef HAVE_STDDEF_H
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,22 @@ char *alloca ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_STDBOOL_H
|
||||||
|
# include <stdbool.h>
|
||||||
|
#else
|
||||||
|
# ifndef HAVE__BOOL
|
||||||
|
# ifdef __cplusplus
|
||||||
|
typedef bool _Bool;
|
||||||
|
# else
|
||||||
|
# define _Bool signed char
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# define bool _Bool
|
||||||
|
# define false 0
|
||||||
|
# define true 1
|
||||||
|
# define __bool_true_false_are_defined 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -109,7 +109,7 @@ blwarn:
|
||||||
static void blacklist_dns_callback(const char *result, int status, int aftype, void *vptr)
|
static void blacklist_dns_callback(const char *result, int status, int aftype, void *vptr)
|
||||||
{
|
{
|
||||||
struct BlacklistClient *blcptr = (struct BlacklistClient *) vptr;
|
struct BlacklistClient *blcptr = (struct BlacklistClient *) vptr;
|
||||||
int listed = 0;
|
bool listed = false;
|
||||||
|
|
||||||
if (blcptr == NULL || blcptr->client_p == NULL)
|
if (blcptr == NULL || blcptr->client_p == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -125,7 +125,7 @@ static void blacklist_dns_callback(const char *result, int status, int aftype, v
|
||||||
if (result != NULL && status)
|
if (result != NULL && status)
|
||||||
{
|
{
|
||||||
if (blacklist_check_reply(blcptr, result))
|
if (blacklist_check_reply(blcptr, result))
|
||||||
listed = TRUE;
|
listed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* they have a blacklist entry for this client */
|
/* they have a blacklist entry for this client */
|
||||||
|
|
|
@ -1833,7 +1833,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
set_channel_mlock(struct Client *client_p, struct Client *source_p,
|
set_channel_mlock(struct Client *client_p, struct Client *source_p,
|
||||||
struct Channel *chptr, const char *newmlock, int propagate)
|
struct Channel *chptr, const char *newmlock, bool propagate)
|
||||||
{
|
{
|
||||||
rb_free(chptr->mode_lock);
|
rb_free(chptr->mode_lock);
|
||||||
chptr->mode_lock = newmlock ? rb_strdup(newmlock) : NULL;
|
chptr->mode_lock = newmlock ? rb_strdup(newmlock) : NULL;
|
||||||
|
|
|
@ -1288,7 +1288,7 @@ exit_remote_client(struct Client *client_p, struct Client *source_p, struct Clie
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This assumes IsUnknown(source_p) == TRUE and MyConnect(source_p) == TRUE
|
* This assumes IsUnknown(source_p) == true and MyConnect(source_p) == true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1466,7 +1466,7 @@ exit_local_server(struct Client *client_p, struct Client *source_p, struct Clien
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This assumes IsPerson(source_p) == TRUE && MyConnect(source_p) == TRUE
|
* This assumes IsPerson(source_p) == true && MyConnect(source_p) == true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -261,7 +261,7 @@ try_connections(void *unused)
|
||||||
struct server_conf *tmp_p;
|
struct server_conf *tmp_p;
|
||||||
struct Class *cltmp;
|
struct Class *cltmp;
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
int connecting = FALSE;
|
bool connecting = false;
|
||||||
int confrq = 0;
|
int confrq = 0;
|
||||||
time_t next = 0;
|
time_t next = 0;
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ try_connections(void *unused)
|
||||||
server_p = tmp_p;
|
server_p = tmp_p;
|
||||||
|
|
||||||
/* We connect only one at time... */
|
/* We connect only one at time... */
|
||||||
connecting = TRUE;
|
connecting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((next > tmp_p->hold) || (next == 0))
|
if((next > tmp_p->hold) || (next == 0))
|
||||||
|
|
|
@ -488,7 +488,7 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
||||||
*modebuf = *parabuf = '\0';
|
*modebuf = *parabuf = '\0';
|
||||||
|
|
||||||
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
|
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
|
||||||
set_channel_mlock(client_p, source_p, chptr, NULL, FALSE);
|
set_channel_mlock(client_p, source_p, chptr, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!IsMember(source_p, chptr))
|
if(!IsMember(source_p, chptr))
|
||||||
|
@ -754,7 +754,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
||||||
strcpy(chptr->chname, parv[2]);
|
strcpy(chptr->chname, parv[2]);
|
||||||
|
|
||||||
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
|
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
|
||||||
set_channel_mlock(client_p, source_p, chptr, NULL, FALSE);
|
set_channel_mlock(client_p, source_p, chptr, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*modebuf != '\0')
|
if(*modebuf != '\0')
|
||||||
|
|
|
@ -235,7 +235,7 @@ ms_mlock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(IsServer(source_p))
|
if(IsServer(source_p))
|
||||||
set_channel_mlock(client_p, source_p, chptr, parv[3], TRUE);
|
set_channel_mlock(client_p, source_p, chptr, parv[3], true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
/* List of ircd includes from ../include/ */
|
/* List of ircd includes from ../include/ */
|
||||||
#include "stdinc.h"
|
#include "stdinc.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "common.h" /* FALSE bleah */
|
#include "common.h"
|
||||||
#include "ircd.h"
|
#include "ircd.h"
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
#include "numeric.h"
|
#include "numeric.h"
|
||||||
|
|
Loading…
Reference in a new issue