This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/udi/udi_common.h

31 lines
579 B
C
Raw Normal View History

2015-10-13 08:17:51 +01:00
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE !FALSE
#endif
/*
* hack to emulate flexible array member of C99
*
* Example
*
* struct header {
* ...
* int data[FLEXIBLE_SIZE];
* };
*
* ...
*
* size_t n = 123;
* struct header *my_header = malloc(SIZEOF_FLEXIBLE(struct header, data, n));
*
*/
#include <stddef.h>
#define FLEXIBLE_SIZE 1
#define SIZEOF_FLEXIBLE(type, member, length) \
( offsetof(type, member) + (length) * sizeof ((type *)0)->member[0] )
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))