61 lines
1.2 KiB
C
61 lines
1.2 KiB
C
|
//
|
||
|
// Created by xajhuang on 2023/3/17.
|
||
|
//
|
||
|
|
||
|
#ifndef VCPE_COMMON_H
|
||
|
#define VCPE_COMMON_H
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
#define _STR(s) #s
|
||
|
#define STR(s) _STR(s)
|
||
|
|
||
|
#ifndef ARRAY_SIZE
|
||
|
//#ifdef __cplusplus
|
||
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||
|
//#else
|
||
|
//#define ARRAY_SIZE_TYPE_CHECK(a) (sizeof(typeof(int[1 - 2 * !!__builtin_types_compatible_p(typeof(a), typeof(&a[0]))])))
|
||
|
//#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]) + ARRAY_SIZE_TYPE_CHECK(a) * 0)
|
||
|
//#endif
|
||
|
#endif
|
||
|
|
||
|
#ifndef UNUSED
|
||
|
#define UNUSED(x) UNUSED_##x __attribute__((__unused__))
|
||
|
#endif
|
||
|
|
||
|
#ifndef MAX_PATH
|
||
|
#define MAX_PATH (512)
|
||
|
#endif
|
||
|
|
||
|
#ifndef TRUE
|
||
|
#define TRUE (1)
|
||
|
#endif
|
||
|
|
||
|
#ifndef FALSE
|
||
|
#define FALSE (0)
|
||
|
#endif
|
||
|
|
||
|
#define VERIFY_STRING(s) (((s) != NULL) && (strlen(s) > 0))
|
||
|
#define SAFETY_STR_STRING(s) ((s) == NULL ? "NULL" : (s))
|
||
|
|
||
|
#define MAX_IP_V4_STR (16)
|
||
|
#define MAX_MAC_ADDR_STR (18)
|
||
|
|
||
|
#define DEBUG_CODE_LINE() LOG_MSG(debug, "\n")
|
||
|
|
||
|
typedef unsigned char U8;
|
||
|
typedef unsigned short U16;
|
||
|
typedef unsigned int U32;
|
||
|
typedef unsigned long long U64;
|
||
|
|
||
|
typedef char S8;
|
||
|
typedef short S16;
|
||
|
typedef int S32;
|
||
|
typedef long long S64;
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
#endif //VCPE_COMMON_H
|