]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - libratbox/src/sigio.c
strip_colour(): strip ASCII 29 (mIRC 7 italics).
[irc/rqf/shadowircd.git] / libratbox / src / sigio.c
index eefd21f26f8c4310c681f1dbad7bd752fee2998e..1afd2cfd8899d37aef88d464143af614a6409935 100644 (file)
@@ -23,7 +23,6 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
  *  USA
  *
- *  $Id: sigio.c 25038 2008-01-23 16:03:08Z androsyn $
  */
 
 #ifndef _GNU_SOURCE
@@ -81,7 +80,7 @@ rb_init_netio_sigio(void)
        int fd;
        pollfd_list.pollfds = rb_malloc(rb_getmaxconnect() * (sizeof(struct pollfd)));
        pollfd_list.allocated = rb_getmaxconnect();
-       for (fd = 0; fd < rb_getmaxconnect(); fd++)
+       for(fd = 0; fd < rb_getmaxconnect(); fd++)
        {
                pollfd_list.pollfds[fd].fd = -1;
        }
@@ -103,7 +102,7 @@ rb_init_netio_sigio(void)
 static inline void
 resize_pollarray(int fd)
 {
-       if(unlikely(fd >= pollfd_list.allocated))
+       if(rb_unlikely(fd >= pollfd_list.allocated))
        {
                int x, old_value = pollfd_list.allocated;
                pollfd_list.allocated += 1024;
@@ -111,7 +110,7 @@ resize_pollarray(int fd)
                        rb_realloc(pollfd_list.pollfds,
                                   pollfd_list.allocated * (sizeof(struct pollfd)));
                memset(&pollfd_list.pollfds[old_value + 1], 0, sizeof(struct pollfd) * 1024);
-               for (x = old_value + 1; x < pollfd_list.allocated; x++)
+               for(x = old_value + 1; x < pollfd_list.allocated; x++)
                {
                        pollfd_list.pollfds[x].fd = -1;
                }
@@ -128,7 +127,7 @@ resize_pollarray(int fd)
  */
 
 int
-rb_setup_fd_sigio(rb_fde_t * F)
+rb_setup_fd_sigio(rb_fde_t *F)
 {
        int flags = 0;
        int fd = F->fd;
@@ -162,7 +161,7 @@ rb_setup_fd_sigio(rb_fde_t * F)
  * and deregister interest in a pending IO state for a given FD.
  */
 void
-rb_setselect_sigio(rb_fde_t * F, unsigned int type, PF * handler, void *client_data)
+rb_setselect_sigio(rb_fde_t *F, unsigned int type, PF * handler, void *client_data)
 {
        if(F == NULL)
                return;
@@ -194,8 +193,8 @@ rb_setselect_sigio(rb_fde_t * F, unsigned int type, PF * handler, void *client_d
                pollfd_list.pollfds[F->fd].fd = -1;
                if(F->fd == pollfd_list.maxindex)
                {
-                       while (pollfd_list.maxindex >= 0
-                              && pollfd_list.pollfds[pollfd_list.maxindex].fd == -1)
+                       while(pollfd_list.maxindex >= 0
+                             && pollfd_list.pollfds[pollfd_list.maxindex].fd == -1)
                                pollfd_list.maxindex--;
                }
        }
@@ -244,7 +243,7 @@ rb_select_sigio(long delay)
                timeout.tv_nsec = (delay % 1000) * 1000000;
        }
 
-       for (;;)
+       for(;;)
        {
                if(!sigio_is_screwed)
                {
@@ -268,7 +267,7 @@ rb_select_sigio(long delay)
 #ifdef SIGIO_SCHED_EVENT
                                if(sig == RTSIGTIM && can_do_event)
                                {
-                                       struct ev_entry *ev = (struct ev_entry *) si.si_ptr;
+                                       struct ev_entry *ev = (struct ev_entry *)si.si_ptr;
                                        if(ev == NULL)
                                                continue;
                                        rb_run_event(ev);
@@ -335,7 +334,7 @@ rb_select_sigio(long delay)
                return RB_OK;
 
        /* XXX we *could* optimise by falling out after doing num fds ... */
-       for (ci = 0; ci < pollfd_list.maxindex + 1; ci++)
+       for(ci = 0; ci < pollfd_list.maxindex + 1; ci++)
        {
                if(((revents = pollfd_list.pollfds[ci].revents) == 0)
                   || (pollfd_list.pollfds[ci].fd) == -1)
@@ -458,7 +457,7 @@ rb_init_netio_sigio(void)
 }
 
 void
-rb_setselect_sigio(rb_fde_t * F, unsigned int type, PF * handler, void *client_data)
+rb_setselect_sigio(rb_fde_t *F, unsigned int type, PF * handler, void *client_data)
 {
        errno = ENOSYS;
        return;
@@ -472,7 +471,7 @@ rb_select_sigio(long delay)
 }
 
 int
-rb_setup_fd_sigio(rb_fde_t * F)
+rb_setup_fd_sigio(rb_fde_t *F)
 {
        errno = ENOSYS;
        return -1;