Make sourcecode compatible with ansi2knr again

This allows to compile ngIRCd using a pre-ANSI K&R C compiler again:
all source files are automatically converted by the included ansi2knr
program (of GNU automake/autoconf) before compiling them with the
K&R C compiler, but a few coding standards must be met.

Tested on Apple A/UX 3.x.
Regression testing on Linux and Mac OS X.
This commit is contained in:
Alexander Barton 2010-10-24 21:48:32 +02:00
parent 5700329f8c
commit 596bc096b0
10 changed files with 63 additions and 28 deletions

View File

@ -103,8 +103,11 @@ GLOBAL const char *ng_ipaddr_tostr PARAMS((const ng_ipaddr_t *addr));
/* convert struct sockaddr to string. dest must be NG_INET_ADDRSTRLEN bytes long */
GLOBAL bool ng_ipaddr_tostr_r PARAMS((const ng_ipaddr_t *addr, char *dest));
#else
static inline const char *
ng_ipaddr_tostr(const ng_ipaddr_t *addr) { return inet_ntoa(addr->sin4.sin_addr); }
static inline const char*
ng_ipaddr_tostr(const ng_ipaddr_t *addr)
{
return inet_ntoa(addr->sin4.sin_addr);
}
static inline bool
ng_ipaddr_tostr_r(const ng_ipaddr_t *addr, char *d)

View File

@ -363,7 +363,8 @@ Client_SetUser( CLIENT *Client, const char *User, bool Idented )
* @param User User name to set.
*/
GLOBAL void
Client_SetOrigUser(CLIENT UNUSED *Client, const char UNUSED *User) {
Client_SetOrigUser(CLIENT UNUSED *Client, const char UNUSED *User)
{
assert(Client != NULL);
assert(User != NULL);

View File

@ -39,7 +39,8 @@ bool
ConnSSL_InitLibrary(void);
#else
static inline bool
ConnSSL_InitLibrary(void) { return true; }
ConnSSL_InitLibrary(void)
{ return true; }
#endif /* SSL_SUPPORT */
#endif /* conf_ssl_h */

View File

@ -844,7 +844,8 @@ Check_ArgIsTrue( const char *Arg )
} /* Check_ArgIsTrue */
static unsigned int Handle_MaxNickLength(int Line, const char *Arg)
static unsigned int
Handle_MaxNickLength(int Line, const char *Arg)
{
unsigned new;

View File

@ -681,9 +681,11 @@ SSL_WantWrite(const CONNECTION *c)
}
#else
static inline bool
SSL_WantRead(UNUSED const CONNECTION *c) { return false; }
SSL_WantRead(UNUSED const CONNECTION *c)
{ return false; }
static inline bool
SSL_WantWrite(UNUSED const CONNECTION *c) { return false; }
SSL_WantWrite(UNUSED const CONNECTION *c)
{ return false; }
#endif

View File

@ -122,7 +122,9 @@ GLOBAL PROC_STAT* Conn_GetProcStat PARAMS((CONN_ID i));
GLOBAL bool Conn_GetCipherInfo PARAMS((CONN_ID Idx, char *buf, size_t len));
GLOBAL bool Conn_UsesSSL PARAMS((CONN_ID Idx));
#else
static inline bool Conn_UsesSSL(UNUSED CONN_ID Idx) { return false; }
static inline bool
Conn_UsesSSL(UNUSED CONN_ID Idx)
{ return false; }
#endif
GLOBAL long Conn_Count PARAMS((void));

View File

@ -115,7 +115,7 @@ static fd_set writers;
* the largest fd registered, plus one.
*/
static int select_maxfd;
static int io_dispatch_select(struct timeval *tv);
static int io_dispatch_select PARAMS((struct timeval *tv));
#ifndef IO_USE_EPOLL
#define io_masterfd -1
@ -127,12 +127,15 @@ static array io_events;
static void io_docallback PARAMS((int fd, short what));
#ifdef DEBUG_IO
static void io_debug(const char *s, int fd, int what)
static void
io_debug(const char *s, int fd, int what)
{
Log(LOG_DEBUG, "%s: %d, %d\n", s, fd, what);
}
#else
static inline void io_debug(const char UNUSED *s,int UNUSED a, int UNUSED b) {/*NOTHING*/}
static inline void
io_debug(const char UNUSED *s,int UNUSED a, int UNUSED b)
{ /* NOTHING */ }
#endif
static io_event *
@ -227,8 +230,12 @@ io_library_init_devpoll(unsigned int eventsize)
eventsize, io_masterfd);
}
#else
static inline void io_close_devpoll(int UNUSED x) {/* NOTHING */}
static inline void io_library_init_devpoll(unsigned int UNUSED ev) {/*NOTHING*/}
static inline void
io_close_devpoll(int UNUSED x)
{ /* NOTHING */ }
static inline void
io_library_init_devpoll(unsigned int UNUSED ev)
{ /* NOTHING */ }
#endif
@ -331,8 +338,12 @@ io_library_init_poll(unsigned int eventsize)
}
}
#else
static inline void io_close_poll(int UNUSED x) {/* NOTHING */}
static inline void io_library_init_poll(unsigned int UNUSED ev) {/*NOTHING*/}
static inline void
io_close_poll(int UNUSED x)
{ /* NOTHING */ }
static inline void
io_library_init_poll(unsigned int UNUSED ev)
{ /* NOTHING */ }
#endif
@ -340,11 +351,15 @@ static inline void io_library_init_poll(unsigned int UNUSED ev) {/*NOTHING*/}
static int
io_dispatch_select(struct timeval *tv)
{
fd_set readers_tmp = readers;
fd_set writers_tmp = writers;
fd_set readers_tmp;
fd_set writers_tmp;
short what;
int ret, i;
int fds_ready;
readers_tmp = readers;
writers_tmp = writers;
ret = select(select_maxfd + 1, &readers_tmp, &writers_tmp, NULL, tv);
if (ret <= 0)
return ret;
@ -418,8 +433,12 @@ io_close_select(int fd)
}
}
#else
static inline void io_library_init_select(int UNUSED x) {/* NOTHING */}
static inline void io_close_select(int UNUSED x) {/* NOTHING */}
static inline void
io_library_init_select(int UNUSED x)
{ /* NOTHING */ }
static inline void
io_close_select(int UNUSED x)
{ /* NOTHING */ }
#endif /* SELECT */
@ -494,7 +513,9 @@ io_library_init_epoll(unsigned int eventsize)
#endif
}
#else
static inline void io_library_init_epoll(unsigned int UNUSED ev) {/* NOTHING */}
static inline void
io_library_init_epoll(unsigned int UNUSED ev)
{ /* NOTHING */ }
#endif /* IO_USE_EPOLL */
@ -620,7 +641,9 @@ io_library_init_kqueue(unsigned int eventsize)
library_initialized = true;
}
#else
static inline void io_library_init_kqueue(unsigned int UNUSED ev) {/* NOTHING */}
static inline void
io_library_init_kqueue(unsigned int UNUSED ev)
{ /* NOTHING */ }
#endif

View File

@ -1239,7 +1239,9 @@ static bool Show_MOTD_SSLInfo(CLIENT *Client)
return ret;
}
#else
static inline bool Show_MOTD_SSLInfo(UNUSED CLIENT *c) { return true; }
static inline bool
Show_MOTD_SSLInfo(UNUSED CLIENT *c)
{ return true; }
#endif
GLOBAL bool

View File

@ -344,15 +344,15 @@ Addr_in_list(const array *resolved_addr, const ng_ipaddr_t *Addr)
static void
Log_Forgery_NoIP(const char *ip, const char *host)
{
Log_Subprocess(LOG_WARNING, "Possible forgery: %s resolved to %s "
"(which has no ip address)", ip, host);
Log_Subprocess(LOG_WARNING,
"Possible forgery: %s resolved to %s (which has no ip address)", ip, host);
}
static void
Log_Forgery_WrongIP(const char *ip, const char *host)
{
Log_Subprocess(LOG_WARNING,"Possible forgery: %s resolved to %s "
"(which points to different address)", ip, host);
Log_Subprocess(LOG_WARNING,
"Possible forgery: %s resolved to %s (which points to different address)", ip, host);
}

View File

@ -186,8 +186,8 @@ CODE facilitynames[] = {
#endif
GLOBAL const char
*ngt_SyslogFacilityName(int Facility)
GLOBAL const char*
ngt_SyslogFacilityName(int Facility)
{
int i = 0;
while(facilitynames[i].c_name) {