summaryrefslogtreecommitdiffstats
path: root/PICA_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'PICA_common.h')
-rw-r--r--PICA_common.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/PICA_common.h b/PICA_common.h
new file mode 100644
index 0000000..bc95be1
--- /dev/null
+++ b/PICA_common.h
@@ -0,0 +1,41 @@
+#ifndef PICA_COMMON_H
+#define PICA_COMMON_H
+
+#ifdef WIN32
+#define CLOSE closesocket
+#define SHUTDOWN(s) shutdown(s,SD_BOTH)
+#else
+#define CLOSE close
+#define SHUTDOWN(s) shutdown(s,SHUT_RDWR)
+#endif
+
+#ifdef WIN32
+#define MSG_NOSIGNAL 0
+#endif
+
+
+//call func for each linked list item
+#define LISTMAP(listname,type,func,arg) \
+{struct type *p;\
+p= listname ## _list_head;\
+while(p)\
+{func(p,arg);p=p->next;}\
+}
+
+#define LISTSEARCH(listname,type, item, value,itemptr) \
+{\
+struct type *p;\
+p= listname ## _list_head;\
+while(p)\
+ {\
+ if (p-> item == value)\
+ {\
+ itemptr=p;\
+ break;\
+ }\
+ p=p->next;\
+ }\
+}
+
+
+#endif