]> git.pond.sub.org Git - empserver/blobdiff - src/client/ringbuf.c
Update copyright notice
[empserver] / src / client / ringbuf.c
index 638c9e4c78040ed6d515633e18f7bc35a61672b5..1a7aa04134faa35a580e670d1314827a39291b99 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2015, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
@@ -39,7 +39,7 @@
 
 /*
  * Initialize empty ring buffer.
- * Not necessary if *R is already zeroed.
+ * Not necessary if *@r is already zeroed.
  */
 void
 ring_init(struct ring *r)
@@ -144,7 +144,7 @@ ring_putm(struct ring *r, void *buf, size_t sz)
 }
 
 /*
- * Discard the N oldest bytes from the ring buffer.
+ * Discard the @n oldest bytes from the ring buffer.
  * It must hold at least that many.
  */
 void
@@ -155,9 +155,9 @@ ring_discard(struct ring *r, int n)
 }
 
 /*
- * Search the ring buffer for zero-terminated string S.
- * Start at the @(n+1)-th byte to be gotten.
- * If found, return the number of bytes in the buffer before S.
+ * Search the ring buffer for zero-terminated string @s.
+ * Start at the (@n+1)-th byte to be gotten.
+ * If found, return the number of bytes in the buffer before @s.
  * Else return -1.
  */
 int
@@ -240,24 +240,3 @@ ring_to_iovec(struct ring *r, struct iovec iov[])
     iov[1].iov_len = prod;
     return 2;
 }
-
-/*
- * Drain ring buffer to file referred by file descriptor @fd.
- * If ring buffer is already empty, do nothing and return 0.
- * Else attempt to write complete contents with writev(), and return
- * its value.
- */
-int
-ring_to_file(struct ring *r, int fd)
-{
-    struct iovec iov[2];
-    int cnt;
-    ssize_t res;
-
-    cnt = ring_to_iovec(r, iov);
-    res = writev(fd, iov, cnt);
-    if (res < 0)
-       return res;
-    ring_discard(r, res);
-    return res;
-}