[mpich2-commits] r7797 - in mpich2/trunk/src: mpid/common/sched mpl/include
goodell at mcs.anl.gov
goodell at mcs.anl.gov
Thu Jan 20 17:40:24 CST 2011
Author: goodell
Date: 2011-01-20 17:40:24 -0600 (Thu, 20 Jan 2011)
New Revision: 7797
Modified:
mpich2/trunk/src/mpid/common/sched/mpid_sched.c
mpich2/trunk/src/mpl/include/mpl_utlist.h
Log:
namespace macros in mpl_utlist.h with 'MPL_'
Also correspondingly update the only current usage of these macros in
mpid_sched.c.
No reviewer.
Modified: mpich2/trunk/src/mpid/common/sched/mpid_sched.c
===================================================================
--- mpich2/trunk/src/mpid/common/sched/mpid_sched.c 2011-01-20 22:54:54 UTC (rev 7796)
+++ mpich2/trunk/src/mpid/common/sched/mpid_sched.c 2011-01-20 23:40:24 UTC (rev 7797)
@@ -265,7 +265,7 @@
/* finally, enqueue in the list of all pending schedules so that the
* progress engine can make progress on it */
- DL_APPEND(all_schedules.head, s);
+ MPL_DL_APPEND(all_schedules.head, s);
dprintf(stderr, "started schedule s=%p\n", s); /* XXX DJG */
MPIDU_Sched_dump(s);
@@ -512,7 +512,7 @@
if (made_progress)
*made_progress = FALSE;
- DL_FOREACH_SAFE(state->head, s, tmp) {
+ MPL_DL_FOREACH_SAFE(state->head, s, tmp) {
dprintf(stderr, "making progress on s=%p\n", s);
/*MPIDU_Sched_dump(s);*/
@@ -561,7 +561,7 @@
dprintf(stderr, "completing and dequeuing s=%p r=%p\n", s, s->req);
/* dequeue this schedule from the state, it's complete */
- DL_DELETE(state->head, s);
+ MPL_DL_DELETE(state->head, s);
/* TODO refactor into a sched_complete routine? */
MPID_REQUEST_SET_COMPLETED(s->req);
Modified: mpich2/trunk/src/mpl/include/mpl_utlist.h
===================================================================
--- mpich2/trunk/src/mpl/include/mpl_utlist.h 2011-01-20 22:54:54 UTC (rev 7796)
+++ mpich2/trunk/src/mpl/include/mpl_utlist.h 2011-01-20 23:40:24 UTC (rev 7797)
@@ -27,10 +27,10 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef UTLIST_H
-#define UTLIST_H
+#ifndef MPL_UTLIST_H
+#define MPL_UTLIST_H
-#define UTLIST_VERSION 1.9.1
+#define MPL_UTLIST_VERSION 1.9.1
/*
* This file contains macros to manipulate singly and doubly-linked lists.
@@ -70,59 +70,59 @@
or, for VS2008 where neither is available, uses casting workarounds. */
#ifdef _MSC_VER /* MS compiler */
#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */
-#define LDECLTYPE(x) decltype(x)
+#define MPL_LDECLTYPE(x) decltype(x)
#else /* VS2008 or older (or VS2010 in C mode) */
-#define NO_DECLTYPE
-#define LDECLTYPE(x) char*
+#define MPL_NO_DECLTYPE
+#define MPL_LDECLTYPE(x) char*
#endif
#else /* GNU, Sun and other compilers */
-#define LDECLTYPE(x) __typeof(x)
+#define MPL_LDECLTYPE(x) __typeof(x)
#endif
#else /* !MPL_HAVE___TYPEOF */
-#define NO_DECLTYPE
-#define LDECLTYPE(x) char*
+#define MPL_NO_DECLTYPE
+#define MPL_LDECLTYPE(x) char*
#endif /* !MPL_HAVE___TYPEOF */
/* for VS2008 we use some workarounds to get around the lack of decltype,
* namely, we always reassign our tmp variable to the list head if we need
* to dereference its prev/next pointers, and save/restore the real head.*/
-#ifdef NO_DECLTYPE
-#define _SV(elt,list) _tmp = (char*)(list); {char **_alias = (char**)&(list); *_alias = (elt); }
-#define _NEXT(elt,list) ((char*)((list)->next))
-#define _NEXTASGN(elt,list,to) { char **_alias = (char**)&((list)->next); *_alias=(char*)(to); }
-#define _PREV(elt,list) ((char*)((list)->prev))
-#define _PREVASGN(elt,list,to) { char **_alias = (char**)&((list)->prev); *_alias=(char*)(to); }
-#define _RS(list) { char **_alias = (char**)&(list); *_alias=_tmp; }
-#define _CASTASGN(a,b) { char **_alias = (char**)&(a); *_alias=(char*)(b); }
+#ifdef MPL_NO_DECLTYPE
+#define MPL__SV(elt,list) _tmp = (char*)(list); {char **_alias = (char**)&(list); *_alias = (elt); }
+#define MPL__NEXT(elt,list) ((char*)((list)->next))
+#define MPL__NEXTASGN(elt,list,to) { char **_alias = (char**)&((list)->next); *_alias=(char*)(to); }
+#define MPL__PREV(elt,list) ((char*)((list)->prev))
+#define MPL__PREVASGN(elt,list,to) { char **_alias = (char**)&((list)->prev); *_alias=(char*)(to); }
+#define MPL__RS(list) { char **_alias = (char**)&(list); *_alias=_tmp; }
+#define MPL__CASTASGN(a,b) { char **_alias = (char**)&(a); *_alias=(char*)(b); }
#else
-#define _SV(elt,list)
-#define _NEXT(elt,list) ((elt)->next)
-#define _NEXTASGN(elt,list,to) ((elt)->next)=(to)
-#define _PREV(elt,list) ((elt)->prev)
-#define _PREVASGN(elt,list,to) ((elt)->prev)=(to)
-#define _RS(list)
-#define _CASTASGN(a,b) (a)=(b)
+#define MPL__SV(elt,list)
+#define MPL__NEXT(elt,list) ((elt)->next)
+#define MPL__NEXTASGN(elt,list,to) ((elt)->next)=(to)
+#define MPL__PREV(elt,list) ((elt)->prev)
+#define MPL__PREVASGN(elt,list,to) ((elt)->prev)=(to)
+#define MPL__RS(list)
+#define MPL__CASTASGN(a,b) (a)=(b)
#endif
/******************************************************************************
* The sort macro is an adaptation of Simon Tatham's O(n log(n)) mergesort *
* Unwieldy variable names used here to avoid shadowing passed-in variables. *
*****************************************************************************/
-#define LL_SORT(list, cmp) \
+#define MPL_LL_SORT(list, cmp) \
do { \
- LDECLTYPE(list) _ls_p; \
- LDECLTYPE(list) _ls_q; \
- LDECLTYPE(list) _ls_e; \
- LDECLTYPE(list) _ls_tail; \
- LDECLTYPE(list) _ls_oldhead; \
- LDECLTYPE(list) _tmp; \
+ MPL_LDECLTYPE(list) _ls_p; \
+ MPL_LDECLTYPE(list) _ls_q; \
+ MPL_LDECLTYPE(list) _ls_e; \
+ MPL_LDECLTYPE(list) _ls_tail; \
+ MPL_LDECLTYPE(list) _ls_oldhead; \
+ MPL_LDECLTYPE(list) _tmp; \
int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \
if (list) { \
_ls_insize = 1; \
_ls_looping = 1; \
while (_ls_looping) { \
- _CASTASGN(_ls_p,list); \
- _CASTASGN(_ls_oldhead,list); \
+ MPL__CASTASGN(_ls_p,list); \
+ MPL__CASTASGN(_ls_oldhead,list); \
list = NULL; \
_ls_tail = NULL; \
_ls_nmerges = 0; \
@@ -132,30 +132,30 @@
_ls_psize = 0; \
for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) { \
_ls_psize++; \
- _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); \
+ MPL__SV(_ls_q,list); _ls_q = MPL__NEXT(_ls_q,list); MPL__RS(list); \
if (!_ls_q) break; \
} \
_ls_qsize = _ls_insize; \
while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) { \
if (_ls_psize == 0) { \
- _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+ _ls_e = _ls_q; MPL__SV(_ls_q,list); _ls_q = MPL__NEXT(_ls_q,list); MPL__RS(list); _ls_qsize--; \
} else if (_ls_qsize == 0 || !_ls_q) { \
- _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+ _ls_e = _ls_p; MPL__SV(_ls_p,list); _ls_p = MPL__NEXT(_ls_p,list); MPL__RS(list); _ls_psize--; \
} else if (cmp(_ls_p,_ls_q) <= 0) { \
- _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+ _ls_e = _ls_p; MPL__SV(_ls_p,list); _ls_p = MPL__NEXT(_ls_p,list); MPL__RS(list); _ls_psize--; \
} else { \
- _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+ _ls_e = _ls_q; MPL__SV(_ls_q,list); _ls_q = MPL__NEXT(_ls_q,list); MPL__RS(list); _ls_qsize--; \
} \
if (_ls_tail) { \
- _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e); _RS(list); \
+ MPL__SV(_ls_tail,list); MPL__NEXTASGN(_ls_tail,list,_ls_e); MPL__RS(list); \
} else { \
- _CASTASGN(list,_ls_e); \
+ MPL__CASTASGN(list,_ls_e); \
} \
_ls_tail = _ls_e; \
} \
_ls_p = _ls_q; \
} \
- _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,NULL); _RS(list); \
+ MPL__SV(_ls_tail,list); MPL__NEXTASGN(_ls_tail,list,MPL_NULL); MPL__RS(list); \
if (_ls_nmerges <= 1) { \
_ls_looping=0; \
} \
@@ -164,21 +164,21 @@
} else _tmp=NULL; /* quiet gcc unused variable warning */ \
} while (0)
-#define DL_SORT(list, cmp) \
+#define MPL_DL_SORT(list, cmp) \
do { \
- LDECLTYPE(list) _ls_p; \
- LDECLTYPE(list) _ls_q; \
- LDECLTYPE(list) _ls_e; \
- LDECLTYPE(list) _ls_tail; \
- LDECLTYPE(list) _ls_oldhead; \
- LDECLTYPE(list) _tmp; \
+ MPL_LDECLTYPE(list) _ls_p; \
+ MPL_LDECLTYPE(list) _ls_q; \
+ MPL_LDECLTYPE(list) _ls_e; \
+ MPL_LDECLTYPE(list) _ls_tail; \
+ MPL_LDECLTYPE(list) _ls_oldhead; \
+ MPL_LDECLTYPE(list) _tmp; \
int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \
if (list) { \
_ls_insize = 1; \
_ls_looping = 1; \
while (_ls_looping) { \
- _CASTASGN(_ls_p,list); \
- _CASTASGN(_ls_oldhead,list); \
+ MPL__CASTASGN(_ls_p,list); \
+ MPL__CASTASGN(_ls_oldhead,list); \
list = NULL; \
_ls_tail = NULL; \
_ls_nmerges = 0; \
@@ -188,32 +188,32 @@
_ls_psize = 0; \
for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) { \
_ls_psize++; \
- _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); \
+ MPL__SV(_ls_q,list); _ls_q = MPL__NEXT(_ls_q,list); MPL__RS(list); \
if (!_ls_q) break; \
} \
_ls_qsize = _ls_insize; \
while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) { \
if (_ls_psize == 0) { \
- _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+ _ls_e = _ls_q; MPL__SV(_ls_q,list); _ls_q = MPL__NEXT(_ls_q,list); MPL__RS(list); _ls_qsize--; \
} else if (_ls_qsize == 0 || !_ls_q) { \
- _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+ _ls_e = _ls_p; MPL__SV(_ls_p,list); _ls_p = MPL__NEXT(_ls_p,list); MPL__RS(list); _ls_psize--; \
} else if (cmp(_ls_p,_ls_q) <= 0) { \
- _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+ _ls_e = _ls_p; MPL__SV(_ls_p,list); _ls_p = MPL__NEXT(_ls_p,list); MPL__RS(list); _ls_psize--; \
} else { \
- _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+ _ls_e = _ls_q; MPL__SV(_ls_q,list); _ls_q = MPL__NEXT(_ls_q,list); MPL__RS(list); _ls_qsize--; \
} \
if (_ls_tail) { \
- _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e); _RS(list); \
+ MPL__SV(_ls_tail,list); MPL__NEXTASGN(_ls_tail,list,_ls_e); MPL__RS(list); \
} else { \
- _CASTASGN(list,_ls_e); \
+ MPL__CASTASGN(list,_ls_e); \
} \
- _SV(_ls_e,list); _PREVASGN(_ls_e,list,_ls_tail); _RS(list); \
+ MPL__SV(_ls_e,list); MPL__PREVASGN(_ls_e,list,_ls_tail); MPL__RS(list); \
_ls_tail = _ls_e; \
} \
_ls_p = _ls_q; \
} \
- _CASTASGN(list->prev, _ls_tail); \
- _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,NULL); _RS(list); \
+ MPL__CASTASGN(list->prev, _ls_tail); \
+ MPL__SV(_ls_tail,list); MPL__NEXTASGN(_ls_tail,list,MPL_NULL); MPL__RS(list); \
if (_ls_nmerges <= 1) { \
_ls_looping=0; \
} \
@@ -222,22 +222,22 @@
} else _tmp=NULL; /* quiet gcc unused variable warning */ \
} while (0)
-#define CDL_SORT(list, cmp) \
+#define MPL_CDL_SORT(list, cmp) \
do { \
- LDECLTYPE(list) _ls_p; \
- LDECLTYPE(list) _ls_q; \
- LDECLTYPE(list) _ls_e; \
- LDECLTYPE(list) _ls_tail; \
- LDECLTYPE(list) _ls_oldhead; \
- LDECLTYPE(list) _tmp; \
- LDECLTYPE(list) _tmp2; \
+ MPL_LDECLTYPE(list) _ls_p; \
+ MPL_LDECLTYPE(list) _ls_q; \
+ MPL_LDECLTYPE(list) _ls_e; \
+ MPL_LDECLTYPE(list) _ls_tail; \
+ MPL_LDECLTYPE(list) _ls_oldhead; \
+ MPL_LDECLTYPE(list) _tmp; \
+ MPL_LDECLTYPE(list) _tmp2; \
int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \
if (list) { \
_ls_insize = 1; \
_ls_looping = 1; \
while (_ls_looping) { \
- _CASTASGN(_ls_p,list); \
- _CASTASGN(_ls_oldhead,list); \
+ MPL__CASTASGN(_ls_p,list); \
+ MPL__CASTASGN(_ls_oldhead,list); \
list = NULL; \
_ls_tail = NULL; \
_ls_nmerges = 0; \
@@ -247,43 +247,43 @@
_ls_psize = 0; \
for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) { \
_ls_psize++; \
- _SV(_ls_q,list); \
- if (_NEXT(_ls_q,list) == _ls_oldhead) { \
+ MPL__SV(_ls_q,list); \
+ if (MPL__NEXT(_ls_q,list) == _ls_oldhead) { \
_ls_q = NULL; \
} else { \
- _ls_q = _NEXT(_ls_q,list); \
+ _ls_q = MPL__NEXT(_ls_q,list); \
} \
- _RS(list); \
+ MPL__RS(list); \
if (!_ls_q) break; \
} \
_ls_qsize = _ls_insize; \
while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) { \
if (_ls_psize == 0) { \
- _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+ _ls_e = _ls_q; MPL__SV(_ls_q,list); _ls_q = MPL__NEXT(_ls_q,list); MPL__RS(list); _ls_qsize--; \
if (_ls_q == _ls_oldhead) { _ls_q = NULL; } \
} else if (_ls_qsize == 0 || !_ls_q) { \
- _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+ _ls_e = _ls_p; MPL__SV(_ls_p,list); _ls_p = MPL__NEXT(_ls_p,list); MPL__RS(list); _ls_psize--; \
if (_ls_p == _ls_oldhead) { _ls_p = NULL; } \
} else if (cmp(_ls_p,_ls_q) <= 0) { \
- _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+ _ls_e = _ls_p; MPL__SV(_ls_p,list); _ls_p = MPL__NEXT(_ls_p,list); MPL__RS(list); _ls_psize--; \
if (_ls_p == _ls_oldhead) { _ls_p = NULL; } \
} else { \
- _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+ _ls_e = _ls_q; MPL__SV(_ls_q,list); _ls_q = MPL__NEXT(_ls_q,list); MPL__RS(list); _ls_qsize--; \
if (_ls_q == _ls_oldhead) { _ls_q = NULL; } \
} \
if (_ls_tail) { \
- _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e); _RS(list); \
+ MPL__SV(_ls_tail,list); MPL__NEXTASGN(_ls_tail,list,_ls_e); MPL__RS(list); \
} else { \
- _CASTASGN(list,_ls_e); \
+ MPL__CASTASGN(list,_ls_e); \
} \
- _SV(_ls_e,list); _PREVASGN(_ls_e,list,_ls_tail); _RS(list); \
+ MPL__SV(_ls_e,list); MPL__PREVASGN(_ls_e,list,_ls_tail); MPL__RS(list); \
_ls_tail = _ls_e; \
} \
_ls_p = _ls_q; \
} \
- _CASTASGN(list->prev,_ls_tail); \
- _CASTASGN(_tmp2,list); \
- _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_tmp2); _RS(list); \
+ MPL__CASTASGN(list->prev,_ls_tail); \
+ MPL__CASTASGN(_tmp2,list); \
+ MPL__SV(_ls_tail,list); MPL__NEXTASGN(_ls_tail,list,_tmp2); MPL__RS(list); \
if (_ls_nmerges <= 1) { \
_ls_looping=0; \
} \
@@ -295,15 +295,15 @@
/******************************************************************************
* singly linked list macros (non-circular) *
*****************************************************************************/
-#define LL_PREPEND(head,add) \
+#define MPL_LL_PREPEND(head,add) \
do { \
(add)->next = head; \
head = add; \
} while (0)
-#define LL_APPEND(head,add) \
+#define MPL_LL_APPEND(head,add) \
do { \
- LDECLTYPE(head) _tmp; \
+ MPL_LDECLTYPE(head) _tmp; \
(add)->next=NULL; \
if (head) { \
_tmp = head; \
@@ -314,9 +314,9 @@
} \
} while (0)
-#define LL_DELETE(head,del) \
+#define MPL_LL_DELETE(head,del) \
do { \
- LDECLTYPE(head) _tmp; \
+ MPL_LDECLTYPE(head) _tmp; \
if ((head) == (del)) { \
(head)=(head)->next; \
} else { \
@@ -330,8 +330,8 @@
} \
} while (0)
-/* Here are VS2008 replacements for LL_APPEND and LL_DELETE */
-#define LL_APPEND_VS2008(head,add) \
+/* Here are VS2008 replacements for MPL_LL_APPEND and MPL_LL_DELETE */
+#define MPL_LL_APPEND_VS2008(head,add) \
do { \
if (head) { \
(add)->next = head; /* use add->next as a temp variable */ \
@@ -343,7 +343,7 @@
(add)->next=NULL; \
} while (0)
-#define LL_DELETE_VS2008(head,del) \
+#define MPL_LL_DELETE_VS2008(head,del) \
do { \
if ((head) == (del)) { \
(head)=(head)->next; \
@@ -361,30 +361,30 @@
} \
} \
} while (0)
-#ifdef NO_DECLTYPE
-#undef LL_APPEND
-#define LL_APPEND LL_APPEND_VS2008
-#undef LL_DELETE
-#define LL_DELETE LL_DELETE_VS2008
+#ifdef MPL_NO_DECLTYPE
+#undef MPL_LL_APPEND
+#define MPL_LL_APPEND MPL_LL_APPEND_VS2008
+#undef MPL_LL_DELETE
+#define MPL_LL_DELETE MPL_LL_DELETE_VS2008
#endif
/* end VS2008 replacements */
-#define LL_FOREACH(head,el) \
+#define MPL_LL_FOREACH(head,el) \
for(el=head;el;el=el->next)
-#define LL_FOREACH_SAFE(head,el,tmp) \
+#define MPL_LL_FOREACH_SAFE(head,el,tmp) \
for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
-#define LL_SEARCH_SCALAR(head,out,field,val) \
+#define MPL_LL_SEARCH_SCALAR(head,out,field,val) \
do { \
- LL_FOREACH(head,out) { \
+ MPL_LL_FOREACH(head,out) { \
if ((out)->field == (val)) break; \
} \
} while(0)
-#define LL_SEARCH(head,out,elt,cmp) \
+#define MPL_LL_SEARCH(head,out,elt,cmp) \
do { \
- LL_FOREACH(head,out) { \
+ MPL_LL_FOREACH(head,out) { \
if ((cmp(out,elt))==0) break; \
} \
} while(0)
@@ -392,7 +392,7 @@
/******************************************************************************
* doubly linked list macros (non-circular) *
*****************************************************************************/
-#define DL_PREPEND(head,add) \
+#define MPL_DL_PREPEND(head,add) \
do { \
(add)->next = head; \
if (head) { \
@@ -404,7 +404,7 @@
(head) = (add); \
} while (0)
-#define DL_APPEND(head,add) \
+#define MPL_DL_APPEND(head,add) \
do { \
if (head) { \
(add)->prev = (head)->prev; \
@@ -418,7 +418,7 @@
} \
} while (0);
-#define DL_DELETE(head,del) \
+#define MPL_DL_DELETE(head,del) \
do { \
if ((del)->prev == (del)) { \
(head)=NULL; \
@@ -436,21 +436,21 @@
} while (0);
-#define DL_FOREACH(head,el) \
+#define MPL_DL_FOREACH(head,el) \
for(el=head;el;el=el->next)
/* this version is safe for deleting the elements during iteration */
-#define DL_FOREACH_SAFE(head,el,tmp) \
+#define MPL_DL_FOREACH_SAFE(head,el,tmp) \
for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
/* these are identical to their singly-linked list counterparts */
-#define DL_SEARCH_SCALAR LL_SEARCH_SCALAR
-#define DL_SEARCH LL_SEARCH
+#define MPL_DL_SEARCH_SCALAR MPL_LL_SEARCH_SCALAR
+#define MPL_DL_SEARCH MPL_LL_SEARCH
/******************************************************************************
* circular doubly linked list macros *
*****************************************************************************/
-#define CDL_PREPEND(head,add) \
+#define MPL_CDL_PREPEND(head,add) \
do { \
if (head) { \
(add)->prev = (head)->prev; \
@@ -464,7 +464,7 @@
(head)=(add); \
} while (0)
-#define CDL_DELETE(head,del) \
+#define MPL_CDL_DELETE(head,del) \
do { \
if ( ((head)==(del)) && ((head)->next == (head))) { \
(head) = 0L; \
@@ -475,27 +475,27 @@
} \
} while (0);
-#define CDL_FOREACH(head,el) \
+#define MPL_CDL_FOREACH(head,el) \
for(el=head;el;el=(el->next==head ? 0L : el->next))
-#define CDL_FOREACH_SAFE(head,el,tmp1,tmp2) \
+#define MPL_CDL_FOREACH_SAFE(head,el,tmp1,tmp2) \
for((el)=(head), ((tmp1)=(head)?((head)->prev):NULL); \
(el) && ((tmp2)=(el)->next, 1); \
((el) = (((el)==(tmp1)) ? 0L : (tmp2))))
-#define CDL_SEARCH_SCALAR(head,out,field,val) \
+#define MPL_CDL_SEARCH_SCALAR(head,out,field,val) \
do { \
- CDL_FOREACH(head,out) { \
+ MPL_CDL_FOREACH(head,out) { \
if ((out)->field == (val)) break; \
} \
} while(0)
-#define CDL_SEARCH(head,out,elt,cmp) \
+#define MPL_CDL_SEARCH(head,out,elt,cmp) \
do { \
- CDL_FOREACH(head,out) { \
+ MPL_CDL_FOREACH(head,out) { \
if ((cmp(out,elt))==0) break; \
} \
} while(0)
-#endif /* UTLIST_H */
+#endif /* MPL_UTLIST_H */
More information about the mpich2-commits
mailing list