1 /* 2 * Copyright (c) 2022-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 #ifndef __HVB_SYSDEPS_H_ 16 #define __HVB_SYSDEPS_H_ 17 18 #include <stdlib.h> 19 #include <stdio.h> 20 #include <stdint.h> 21 #include "securec.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #define HVB_ATTR_PACKED __attribute__((packed)) 28 29 int hvb_memcmp(const void *src1, const void *src2, size_t n); 30 int hvb_strcmp(const char *s1, const char *s2); 31 int hvb_strncmp(const char *s1, const char *s2, size_t n); 32 void *hvb_memcpy(void *dest, const void *src, size_t n); 33 int hvb_memcpy_s(void *dest, size_t destMax, const void *src, size_t count); 34 void *hvb_memset(void *dest, const int c, size_t n); 35 int hvb_memset_s(void *dest, size_t destMax, int c, size_t count); 36 void hvb_print(const char *message); 37 void hvb_printv(const char *message, ...); 38 void *hvb_malloc_(size_t size); 39 void hvb_free(void *ptr); 40 void hvb_abort(void); 41 size_t hvb_strlen(const char *str); 42 size_t hvb_strnlen(const char *str, size_t len); 43 uint32_t hvb_div_by_10(uint64_t *dividend); 44 45 #ifdef __cplusplus 46 } 47 #endif 48 49 #endif /* __HVB_SYSDEPS_H_ */ 50