[Asterisk-cvs] asterisk/include/asterisk astobj.h,1.7,1.8
markster at lists.digium.com
markster at lists.digium.com
Fri Jan 7 00:10:01 CST 2005
Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv29574/include/asterisk
Modified Files:
astobj.h
Log Message:
Include lock performance (bug #3234)
Index: astobj.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/astobj.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- astobj.h 4 Jan 2005 06:16:04 -0000 1.7
+++ astobj.h 7 Jan 2005 06:14:50 -0000 1.8
@@ -161,6 +161,16 @@
ASTOBJ_CONTAINER_UNLOCK(container); \
} while(0)
+#define ASTOBJ_CONTAINER_FIND(container,namestr) \
+ ({ \
+ typeof((container)->head) found = NULL; \
+ ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
+ if (!(strcasecmp(iterator->name, (namestr)))) \
+ found = ASTOBJ_REF(iterator); \
+ } while (0)); \
+ found; \
+ })
+
#define ASTOBJ_CONTAINER_FIND_FULL(container,data,field,hashfunc,hashoffset,comparefunc) \
({ \
typeof((container)->head) found = NULL; \
@@ -186,6 +196,25 @@
ASTOBJ_CONTAINER_UNLOCK(container); \
} while(0)
+#define ASTOBJ_CONTAINER_FIND_UNLINK(container,namestr) \
+ ({ \
+ typeof((container)->head) found = NULL; \
+ typeof((container)->head) prev = NULL; \
+ ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
+ if (!(strcasecmp(iterator->name, (namestr)))) { \
+ found = iterator; \
+ ASTOBJ_CONTAINER_WRLOCK(container); \
+ if (prev) \
+ prev->next[0] = next; \
+ else \
+ (container)->head = next; \
+ ASTOBJ_CONTAINER_UNLOCK(container); \
+ } \
+ prev = iterator; \
+ } while (0)); \
+ found; \
+ })
+
#define ASTOBJ_CONTAINER_FIND_UNLINK_FULL(container,data,field,hashfunc,hashoffset,comparefunc) \
({ \
typeof((container)->head) found = NULL; \
@@ -252,12 +281,6 @@
#define ASTOBJ_CONTAINER_DESTROY(container) \
ASTOBJ_CONTAINER_DESTROY_FULL(container,1,ASTOBJ_DEFAULT_BUCKETS)
-#define ASTOBJ_CONTAINER_FIND(container,namestr) \
- ASTOBJ_CONTAINER_FIND_FULL(container,namestr,name,ASTOBJ_DEFAULT_HASH,0,strcasecmp)
-
-#define ASTOBJ_CONTAINER_FIND_UNLINK(container,namestr) \
- ASTOBJ_CONTAINER_FIND_UNLINK_FULL(container,namestr,name,ASTOBJ_DEFAULT_HASH,0,strcasecmp)
-
#define ASTOBJ_CONTAINER_LINK(container,newobj) \
ASTOBJ_CONTAINER_LINK_FULL(container,newobj,(newobj)->name,name,ASTOBJ_DEFAULT_HASH,0,strcasecmp)
More information about the svn-commits
mailing list