This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/common/include/tfe_util.h

21 lines
772 B
C

//#define ALLOC(t,n) (t *)calloc(sizeof(t),(n))
/* Allocates an array of objects using malloc() */
#define ALLOC(type, number) \
((type *)calloc(sizeof(type), number))
#define log_err_printf(fmt, args...) \
fprintf(stderr, "file %s, line %d, " fmt, \
__FILE__, __LINE__, ##args)
#define log_dbg_printf(fmt, args...) \
fprintf(stdout, "file %s, line %d, " fmt, \
__FILE__, __LINE__, ##args)
#define likely(expr) __builtin_expect((expr), 1)
#define unlikely(expr) __builtin_expect((expr), 0)
int addr_sock2layer(struct sockaddr * sock_addr, int sockaddrlen, struct layer_addr* layer_addr);
int addr_layer2sock(struct layer_addr* layer_addr,struct sockaddr * sock_addr);
char* tfe_strdup(const char* s);