commit 596bc096b02ef94efe3d73bb747c6ab0368f63bf from: Alexander Barton date: Sun Oct 24 19:48:32 2010 UTC 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. commit - 5700329f8c7dda39610f5836d641f4cea6912197 commit + 596bc096b02ef94efe3d73bb747c6ab0368f63bf blob - 4582e2a533eca80c7948d0ca00db3fc5106348d8 blob + 54a970362e5084e0193a6ea21519213dcd41038b --- src/ipaddr/ng_ipaddr.h +++ src/ipaddr/ng_ipaddr.h @@ -103,8 +103,11 @@ GLOBAL const char *ng_ipaddr_tostr PARAMS((const ng_ip /* 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) blob - 033478356ea2e9ddadc963fc2493476ad0b86810 blob + 739c5ea5f77e64a95c8e4bc25dd9bfa8aed0f35b --- src/ngircd/client.c +++ src/ngircd/client.c @@ -363,7 +363,8 @@ Client_SetUser( CLIENT *Client, const char *User, bool * @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); blob - e88d3e89886d3cd88681753df8b157410da3639f blob + cdb996828c4b0e68dd8e0f8ce01823e254bda953 --- src/ngircd/conf-ssl.h +++ src/ngircd/conf-ssl.h @@ -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 */ blob - f8b470fa13e8e349ff54a84461783ef8afd7b551 blob + 4804f2bb378b8e8b5578580e5119ecea6818103d --- src/ngircd/conf.c +++ src/ngircd/conf.c @@ -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; blob - d74f2511e4414e97a38a9d4f4a45fa9cdd518b58 blob + bbb186e9b19d60186593db1084e8d6a5d88fede0 --- src/ngircd/conn.c +++ src/ngircd/conn.c @@ -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 blob - 1e938ada5578794f065ad81ffa130d507937184d blob + 280c61bb8dea77b0b39070607ebecc91fa30ec13 --- src/ngircd/conn.h +++ src/ngircd/conn.h @@ -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)); blob - 411b383ef3ed6393d63b5417e2f851119f1f008f blob + d13a5e25b0b2dec413198e7feb494ca0cd2e14aa --- src/ngircd/io.c +++ src/ngircd/io.c @@ -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 U 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 blob - 8f86e805315f4294dc4a6583d8a2150fd51691aa blob + 638a8e92f9156be6a453af1ae07224426040ecb3 --- src/ngircd/irc-info.c +++ src/ngircd/irc-info.c @@ -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 blob - 9bc3a87a07e3a1fd91e960505d5e783e1c90f76a blob + 5839c19498cde0d8b9939d449bc947537eb678cf --- src/ngircd/resolve.c +++ src/ngircd/resolve.c @@ -344,15 +344,15 @@ Addr_in_list(const array *resolved_addr, const ng_ipad 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); } blob - 9e2907494b4c9402a79d7b2b1792f5bc3003a590 blob + dbdb49a2d9904d97d1fe7369c95b56780ac6da8d --- src/tool/tool.c +++ src/tool/tool.c @@ -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) {