From a8c48bb76f291c673438d2061753d05a0d9b3276 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 9 Dec 2009 17:28:48 +0000 Subject: bgp: move cleanup fifo code This patch started while looking at the compiler aliasing warnings from FIFO_HEAD() in BGP. Then I realized the FIFO code was only being used in BGP, so it made sense to move it from zebra to BGP. In the process convert from macro's to inline and add more type safety. --- lib/zebra.h | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'lib/zebra.h') diff --git a/lib/zebra.h b/lib/zebra.h index 2dc84514..5d863599 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -538,43 +538,4 @@ typedef u_int8_t safi_t; typedef u_int16_t zebra_size_t; typedef u_int16_t zebra_command_t; -/* FIFO -- first in first out structure and macros. */ -struct fifo -{ - struct fifo *next; - struct fifo *prev; -}; - -#define FIFO_INIT(F) \ - do { \ - struct fifo *Xfifo = (struct fifo *)(F); \ - Xfifo->next = Xfifo->prev = Xfifo; \ - } while (0) - -#define FIFO_ADD(F,N) \ - do { \ - struct fifo *Xfifo = (struct fifo *)(F); \ - struct fifo *Xnode = (struct fifo *)(N); \ - Xnode->next = Xfifo; \ - Xnode->prev = Xfifo->prev; \ - Xfifo->prev = Xfifo->prev->next = Xnode; \ - } while (0) - -#define FIFO_DEL(N) \ - do { \ - struct fifo *Xnode = (struct fifo *)(N); \ - Xnode->prev->next = Xnode->next; \ - Xnode->next->prev = Xnode->prev; \ - } while (0) - -#define FIFO_HEAD(F) \ - ((((struct fifo *)(F))->next == (struct fifo *)(F)) \ - ? NULL : (F)->next) - -#define FIFO_EMPTY(F) \ - (((struct fifo *)(F))->next == (struct fifo *)(F)) - -#define FIFO_TOP(F) \ - (FIFO_EMPTY(F) ? NULL : ((struct fifo *)(F))->next) - #endif /* _ZEBRA_H */ -- cgit v1.2.3