]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Get rid of broken BUFFER_BYTES_AVAIL macro, replace it with new macros.
authorTed Lemon <source@isc.org>
Tue, 19 Oct 1999 15:33:17 +0000 (15:33 +0000)
committerTed Lemon <source@isc.org>
Tue, 19 Oct 1999 15:33:17 +0000 (15:33 +0000)
includes/omapip/buffer.h

index 5b844519cde46129650f94085dd11ff6136d59ba..20149ee90a7541598860814d0437e4de31743344 100644 (file)
@@ -48,10 +48,15 @@ typedef struct _omapi_buffer {
                                           the buffer data structure. */
 } omapi_buffer_t;      
 
-#define BUFFER_BYTES_AVAIL(x)  \
-       (((x) -> head < (x) -> tail \
-         ? (x) -> tail - (x) -> head \
-         : sizeof ((x) -> buf) - ((x) -> head - (x) -> tail)) - 1)
+#define BUFFER_BYTES_FREE(x)   \
+       ((x) -> tail > (x) -> head \
+         ? sizeof ((x) -> buf) - ((x) -> tail - (x) -> head) \
+         : (x) -> head - (x) -> tail)
+
+#define BYTES_IN_BUFFER(x)     \
+       ((x) -> tail > (x) -> head \
+        ? (x) -> tail - (x) -> head - 1 \
+        : sizeof ((x) -> buf) - ((x) -> head - (x) -> tail) - 1)
 
 isc_result_t omapi_connection_require (omapi_object_t *, unsigned);
 isc_result_t omapi_connection_copyout (unsigned char *,