-/*
+/*
* ring.c:
*
* Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
*
*/
-static char rcsid[] = "$Id$";
+static char rcsid[] = "$Id: ring.c,v 1.8 2008/03/07 13:16:02 james Exp $";
-/*
- * $Log$
+/*
+ * $Log: ring.c,v $
+ * Revision 1.8 2008/03/07 13:16:02 james
+ * *** empty log message ***
+ *
+ * Revision 1.7 2008/03/07 12:37:04 james
+ * *** empty log message ***
+ *
+ * Revision 1.6 2008/03/03 06:04:42 james
+ * *** empty log message ***
+ *
+ * Revision 1.5 2008/03/02 10:37:56 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/13 16:57:29 james
* *** empty log message ***
*
{
int red = 0;
- while (n--)
- {
+ while (n--) {
- if (!ring_read_one (r, b))
- break;
+ if (!ring_read_one (r, b))
+ break;
- b++;
- red++;
- }
+ b++;
+ red++;
+ }
return red;
}
{
int writ = 0;
- while (n--)
- {
+ while (n--) {
- if (!ring_write_one (r, b))
- break;
+ if (!ring_write_one (r, b))
+ break;
- b++;
- writ++;
- }
+ b++;
+ writ++;
+ }
return writ;
}
Ring *
ring_new (int n)
{
- Ring *ret = (Ring *) malloc (sizeof (Ring));
- ret->ring = (uint8_t *) malloc (n);
+ Ring *ret = (Ring *) xmalloc (sizeof (Ring));
+ ret->ring = (uint8_t *) xmalloc (n);
ret->size = n;
ret->wptr = ret->rptr = 0;