mirror of
https://github.com/samba-team/samba.git
synced 2025-11-12 04:23:49 +03:00
r22297: move ZERO_*, ARRAY_SIZE and PTR_DIFF macros into libreplace
metze
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
38aeb585a1
commit
b69c950858
@@ -41,31 +41,6 @@ extern const char *panic_action;
|
||||
#include "util/byteorder.h"
|
||||
#include "lib/util/util_proto.h"
|
||||
|
||||
/**
|
||||
* zero a structure
|
||||
*/
|
||||
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
|
||||
|
||||
/**
|
||||
* zero a structure given a pointer to the structure
|
||||
*/
|
||||
#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
|
||||
|
||||
/**
|
||||
* zero a structure given a pointer to the structure - no zero check
|
||||
*/
|
||||
#define ZERO_STRUCTPN(x) memset((char *)(x), 0, sizeof(*(x)))
|
||||
|
||||
/**
|
||||
* pointer difference macro
|
||||
*/
|
||||
#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
|
||||
|
||||
/**
|
||||
* work out how many elements there are in a static array
|
||||
*/
|
||||
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
/**
|
||||
* assert macros
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user