45 lines
939 B
C
45 lines
939 B
C
#ifndef DEPLOYD_DEF_H_
|
|
#define DEPLOYD_DEF_H_
|
|
|
|
#include "conf.h"
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
#ifndef NULL
|
|
#define NULL ((void *)0)
|
|
#endif /* NULL */
|
|
|
|
#define DP_MIN(a, b) (((a) > (b)) ? (b) : (a))
|
|
#define DP_MAX(a, b) (((a) < (b)) ? (b) : (a))
|
|
|
|
#ifndef DP_MALLOC
|
|
#define DP_MALLOC(size) malloc((size))
|
|
#endif /* DP_MALLOC */
|
|
|
|
#ifndef DP_CALLOC
|
|
#define DP_CALLOC(nmemb, size) calloc((nmemb), (size))
|
|
#endif /* DP_CALLOC */
|
|
|
|
#ifndef DP_FREE
|
|
#define DP_FREE(ptr) free((ptr))
|
|
#endif /* DP_FREE */
|
|
|
|
#ifndef DP_REALLOC
|
|
#define DP_REALLOC(ptr, size) realloc((ptr), (size))
|
|
#endif /* DP_REALLOC */
|
|
|
|
#define dp__STR_HELPER(x) #x
|
|
#define DP_STR(x) dp__STR_HELPER(x)
|
|
|
|
uint64_t dp_buf2u64_le(const uint8_t buf[8]);
|
|
bool dp_u642buf_le(uint8_t buf[8], uint64_t num);
|
|
|
|
bool dp_isnumber(const char *num);
|
|
|
|
int dp_u642str(char buf[21], uint64_t value);
|
|
|
|
uint64_t dp_str2u64(const char *num);
|
|
|
|
#endif /* DEPLOYD_DEF_H_ */
|