00001
00058 #ifndef __CDP_UTILS_H_
00059 #define __CDP_UTILS_H_
00060
00061 #ifdef CDP_FOR_SER
00062
00063 #include "../../dprint.h"
00064 #include "../../str.h"
00065 #include "../../mem/mem.h"
00066 #include "../../mem/shm_mem.h"
00067 #include "../../locking.h"
00068 #include "../../pt.h"
00069
00070 #else
00071
00072 #include "../utils/config.h"
00073 #include "../utils/dprint.h"
00074 #include "../utils/str.h"
00075 #include "../utils/mem.h"
00076 #include "../utils/shm_mem.h"
00077 #include "../utils/locking.h"
00078
00079 #endif
00080
00081
00082 #define LOG_NO_MEM(mem_type,data_len) \
00083 LOG(L_ERR,"ERROR:%s:%s()[%d]: Out of %s memory allocating %d bytes\n",\
00084 __FILE__,__FUNCTION__,__LINE__, \
00085 mem_type,data_len);
00086
00087 #define shm_str_dup(dst,src)\
00088 {\
00089 (dst).s = shm_malloc((src).len+1);\
00090 if (!(dst).s){LOG_NO_MEM("shm",(src).len+1);}\
00091 else {memcpy((dst).s,(src).s,(src).len);(dst).s[(src).len]=0;(dst).len=(src).len;}\
00092 }
00093
00094 #endif