cmocka.c | cmocka.c | |||
---|---|---|---|---|
skipping to change at line 81 | skipping to change at line 81 | |||
/* Calculates the number of elements in an array. */ | /* Calculates the number of elements in an array. */ | |||
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) | #define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) | |||
/* | /* | |||
* Declare and initialize the pointer member of ValuePointer variable name | * Declare and initialize the pointer member of ValuePointer variable name | |||
* with ptr. | * with ptr. | |||
*/ | */ | |||
#define declare_initialize_value_pointer_pointer(name, ptr) \ | #define declare_initialize_value_pointer_pointer(name, ptr) \ | |||
ValuePointer name ; \ | ValuePointer name ; \ | |||
name.value = 0; \ | name.value = 0; \ | |||
name.pointer = (void*)(ptr) | name.x.pointer = (void*)(ptr) | |||
/* | /* | |||
* Declare and initialize the value member of ValuePointer variable name | * Declare and initialize the value member of ValuePointer variable name | |||
* with val. | * with val. | |||
*/ | */ | |||
#define declare_initialize_value_pointer_value(name, val) \ | #define declare_initialize_value_pointer_value(name, val) \ | |||
ValuePointer name ; \ | ValuePointer name ; \ | |||
name.value = val | name.value = val | |||
/* Cast a LargestIntegralType to pointer_type via a ValuePointer. */ | /* Cast a LargestIntegralType to pointer_type via a ValuePointer. */ | |||
#define cast_largest_integral_type_to_pointer( \ | #define cast_largest_integral_type_to_pointer( \ | |||
pointer_type, largest_integral_type) \ | pointer_type, largest_integral_type) \ | |||
((pointer_type)((ValuePointer*)&(largest_integral_type))->pointer) | ((pointer_type)((ValuePointer*)&(largest_integral_type))->x.pointer) | |||
/* Used to cast LargetIntegralType to void* and vice versa. */ | /* Used to cast LargetIntegralType to void* and vice versa. */ | |||
typedef union ValuePointer { | typedef union ValuePointer { | |||
LargestIntegralType value; | LargestIntegralType value; | |||
void *pointer; | struct { | |||
#if defined(WORDS_BIGENDIAN) && (WORDS_SIZEOF_VOID_P == 4) | ||||
unsigned int padding; | ||||
#endif | ||||
void *pointer; | ||||
} x; | ||||
} ValuePointer; | } ValuePointer; | |||
/* Doubly linked list node. */ | /* Doubly linked list node. */ | |||
typedef struct ListNode { | typedef struct ListNode { | |||
const void *value; | const void *value; | |||
int refcount; | int refcount; | |||
struct ListNode *next; | struct ListNode *next; | |||
struct ListNode *prev; | struct ListNode *prev; | |||
} ListNode; | } ListNode; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 8 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |