]> git.pond.sub.org Git - empserver/blobdiff - src/lib/gen/ioqueue.c
Update copyright notice.
[empserver] / src / lib / gen / ioqueue.c
index 2ed7738341e886981c5ff9382347842254ed342a..fba71df9abf7c28bdca8d482108bb082b2a4b059 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
 #include <config.h>
 
 #include <stdio.h>
-#include <stdlib.h>            /* malloc free */
-#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
 #if !defined(_WIN32)
+#include <sys/types.h>
 #include <sys/uio.h>
 #endif
+#include "ioqueue.h"
 #include "misc.h"
 #include "queue.h"
-#include "ioqueue.h"
 
-static int ioqtocbuf(struct ioqueue *ioq, s_char *buf, int cc,
-                    register int stopc);
+static int ioqtocbuf(struct ioqueue *ioq, char *buf, int cc, int stopc);
 #if !defined(_WIN32)
-static int ioqtoiov(struct ioqueue *ioq, struct iovec *iov,
-                   register int max);
-#endif
-static int ioqtobuf(struct ioqueue *ioq, s_char *buf, int cc);
-static int appendcc(struct ioqueue *ioq, s_char *buf, int cc);
-static int removecc(struct ioqueue *ioq, register int cc);
-
-#if defined(_WIN32)
-static void loc_StripDels(char *pBuf);
+static int ioqtoiov(struct ioqueue *ioq, struct iovec *iov, int max);
 #endif
+static int ioqtobuf(struct ioqueue *ioq, char *buf, int cc);
+static int appendcc(struct ioqueue *ioq, char *buf, int cc);
+static int removecc(struct ioqueue *ioq, int cc);
 
 struct ioqueue *
 ioq_create(int size)
@@ -123,7 +118,7 @@ ioq_makeiov(struct ioqueue *ioq, struct iovec *iov, int cc)
  * number of bytes actually found.
  */
 int
-ioq_peek(struct ioqueue *ioq, s_char *buf, int cc)
+ioq_peek(struct ioqueue *ioq, char *buf, int cc)
 {
     return ioqtobuf(ioq, buf, cc);
 }
@@ -135,7 +130,7 @@ ioq_dequeue(struct ioqueue *ioq, int cc)
 }
 
 void
-ioq_append(struct ioqueue *ioq, s_char *buf, int cc)
+ioq_append(struct ioqueue *ioq, char *buf, int cc)
 {
     appendcc(ioq, buf, cc);
 }
@@ -152,7 +147,7 @@ ioq_qsize(struct ioqueue *ioq)
  * no input is available
  */
 int
-ioq_gets(struct ioqueue *ioq, s_char *buf, int cc)
+ioq_gets(struct ioqueue *ioq, char *buf, int cc)
 {
     int nbytes;
     int actual;
@@ -173,30 +168,24 @@ ioq_gets(struct ioqueue *ioq, s_char *buf, int cc)
 }
 
 int
-ioq_puts(struct ioqueue *ioq, s_char *buf)
+ioq_puts(struct ioqueue *ioq, char *buf)
 {
     return appendcc(ioq, buf, strlen(buf));
 }
 
-/*
- * all the rest are local to this module
- */
-
-
 /*
  * copy cc bytes from ioq to buf.
  * this routine doesn't free memory; this is
  * left for a higher level.
  */
 static int
-ioqtobuf(struct ioqueue *ioq, s_char *buf, int cc)
+ioqtobuf(struct ioqueue *ioq, char *buf, int cc)
 {
     struct io *io;
     struct emp_qelem *qp;
     struct emp_qelem *head;
-    register int nbytes;
-    register int nleft;
-    register s_char *offset;
+    int nbytes, nleft;
+    char *offset;
 
     nleft = cc;
     offset = buf;
@@ -223,11 +212,11 @@ ioqtobuf(struct ioqueue *ioq, s_char *buf, int cc)
  * terminating on the stop character.
  */
 static int
-ioqtocbuf(struct ioqueue *ioq, s_char *buf, int cc, register int stopc)
+ioqtocbuf(struct ioqueue *ioq, char *buf, int cc, int stopc)
 {
-    register int nbytes;
-    register s_char *p;
-    register int n;
+    int nbytes;
+    char *p;
+    int n;
     struct io *io;
     struct emp_qelem *qp;
     struct emp_qelem *head;
@@ -261,12 +250,10 @@ ioqtocbuf(struct ioqueue *ioq, s_char *buf, int cc, register int stopc)
  */
 #if !defined(_WIN32)
 static int
-ioqtoiov(struct ioqueue *ioq, struct iovec *iov, register int max)
+ioqtoiov(struct ioqueue *ioq, struct iovec *iov, int max)
 {
     struct io *io;
-    register int cc;
-    register int niov;
-    register int len;
+    int cc, niov, len;
     struct emp_qelem *qp;
 
     cc = max;
@@ -294,11 +281,11 @@ ioqtoiov(struct ioqueue *ioq, struct iovec *iov, register int max)
  * append a buffer to the end of the ioq.
  */
 static int
-appendcc(struct ioqueue *ioq, s_char *buf, int cc)
+appendcc(struct ioqueue *ioq, char *buf, int cc)
 {
     struct io *io;
     int len;
-    s_char *ptr;
+    char *ptr;
     int avail;
 
     /* determine if any space is left */
@@ -334,13 +321,11 @@ appendcc(struct ioqueue *ioq, s_char *buf, int cc)
  * which are no longer used.
  */
 static int
-removecc(struct ioqueue *ioq, register int cc)
+removecc(struct ioqueue *ioq, int cc)
 {
     struct io *io;
     struct emp_qelem *qp;
-    register int nbytes;
-    register int there;
-    register int remain;
+    int nbytes, there, remain;
 
     nbytes = 0;
     remain = cc;
@@ -389,7 +374,7 @@ ioq_makebuf(struct ioqueue *ioq, char *pBuf, int nBufLen)
     int nbytes;
     int nleft;
     int ncopied;
-    s_char *offset;
+    char *offset;
 
     ncopied = 0;
     nleft = nBufLen;