• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *    http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HC_TYPES_H
17 #define HC_TYPES_H
18 
19 #include <stdlib.h>
20 #include <stdint.h>
21 #include <string.h>
22 #include <stdbool.h>
23 #include "securec.h"
24 
25 typedef uint32_t HcBool;
26 #define HC_TRUE 1
27 #define HC_FALSE 0
28 
29 #ifndef NULL
30 #define NULL 0
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #ifdef DEV_AUTH_MEMORY_DEBUG
38 
39 #define HcMalloc(size, val) MockMalloc(size, val, __FILE__, __LINE__)
40 #define HcFree(addr) MockFree(addr)
41 void *MockMalloc(uint32_t size, char val, const char *strFile, int nLine);
42 void MockFree(void *addr);
43 
44 #else
45 
46 void* HcMalloc(uint32_t size, char val);
47 void HcFree(void* addr);
48 
49 #endif
50 
51 uint32_t HcStrlen(const char *str);
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif