summaryrefslogtreecommitdiff
path: root/src/list.h
diff options
context:
space:
mode:
authorfcolin2002-12-16 14:51:27 +0000
committerfcolin2002-12-16 14:51:27 +0000
commita0963c921b51df6817448d419483a64c47046326 (patch)
treee2b338eaa37c6febe9cbb5379e7471274ee5209c /src/list.h
parent809dd9c2eeb1441f04234bdd23d862b98fe4ff9b (diff)
downloadivy-c-a0963c921b51df6817448d419483a64c47046326.zip
ivy-c-a0963c921b51df6817448d419483a64c47046326.tar.gz
ivy-c-a0963c921b51df6817448d419483a64c47046326.tar.bz2
ivy-c-a0963c921b51df6817448d419483a64c47046326.tar.xz
passage en GCC 3.2
Diffstat (limited to 'src/list.h')
-rw-r--r--src/list.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/list.h b/src/list.h
index 0c31223..78eb07e 100644
--- a/src/list.h
+++ b/src/list.h
@@ -13,14 +13,21 @@
* Please refer to file version.h for the
* copyright notice regarding this software
*/
+#if (__GNUC__ >= 3)
+#define TYPEOF(p) typeof (p)
+#else
+#define TYPEOF(p) void *
+#endif
#define IVY_LIST_ITER( list, p, cond ) \
p = list; \
while ( p && (cond) ) p = p->next
+
+
#define IVY_LIST_REMOVE( list, p ) \
{ \
- void *toRemove; \
+ TYPEOF(p) toRemove; \
if ( list == p ) \
{ \
list = p->next; \
@@ -33,8 +40,8 @@
if ( p )\
{\
/* somme tricky swapping to use a untyped variable */\
- void *suiv; \
- void *prec = p;\
+ TYPEOF(p) suiv; \
+ TYPEOF(p) prec = p;\
p = toRemove;\
suiv = p->next;\
p = prec;\
@@ -45,7 +52,7 @@
}
#define IVY_LIST_ADD(list, p ) \
- if ((p = malloc( sizeof( *p ))))\
+ if ( p = (TYPEOF(p)) (malloc( sizeof( *p ))))\
{ \
memset( p, 0 , sizeof( *p ));\
p->next = list; \
@@ -60,7 +67,7 @@ for ( p = list ; (next = p ? p->next: p ),p ; p = next )
#define IVY_LIST_EMPTY( list ) \
{ \
- void *p; \
+ TYPEOF(list) p; \
while( list ) \
{ \
p = list;\