Changeset 30 for trunk/samba/source/include/smb_macros.h
- Timestamp:
- Apr 25, 2007, 9:44:55 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/samba/source/include/smb_macros.h
r1 r30 47 47 #endif 48 48 49 /* zero a structure */50 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))51 52 /* zero a structure given a pointer to the structure */53 #define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)54 55 /* zero a structure given a pointer to the structure - no zero check */56 #define ZERO_STRUCTPN(x) memset((char *)(x), 0, sizeof(*(x)))57 58 /* zero an array - note that sizeof(array) must work - ie. it must not be a59 pointer */60 #define ZERO_ARRAY(x) memset((char *)(x), 0, sizeof(x))61 62 /* pointer difference macro */63 #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))64 65 /* work out how many elements there are in a static array */66 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))67 68 49 /* assert macros */ 69 50 #ifdef DEVELOPER … … 351 332 #else 352 333 353 #define _STRING_LINE_(s) #s354 #define _STRING_LINE2_(s) _STRING_LINE_(s)355 #define __LINESTR__ _STRING_LINE2_(__LINE__)356 #define __location__ __FILE__ ":" __LINESTR__357 358 334 #define PRS_ALLOC_MEM(ps, type, count) (type *)prs_alloc_mem((ps),sizeof(type),(count)) 359 335 #define PRS_ALLOC_MEM_VOID(ps, size) prs_alloc_mem((ps),(size),1)
Note: See TracChangeset
for help on using the changeset viewer.