bh_common.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef _BH_COMMON_H
  17. #define _BH_COMMON_H
  18. #include "bh_assert.h"
  19. #include "bh_definition.h"
  20. #include "bh_platform.h"
  21. #include "bh_log.h"
  22. #include "bh_list.h"
  23. typedef void (*bh_print_function_t)(const char* message);
  24. void bh_set_print_function(bh_print_function_t pf);
  25. #define bh_memcpy_s(dest, dlen, src, slen) do { \
  26. int _ret = slen == 0 ? 0 : b_memcpy_s (dest, dlen, src, slen); \
  27. (void)_ret; \
  28. bh_assert (_ret == 0); \
  29. } while (0)
  30. #define bh_strcat_s(dest, dlen, src) do { \
  31. int _ret = b_strcat_s (dest, dlen, src); \
  32. (void)_ret; \
  33. bh_assert (_ret == 0); \
  34. } while (0)
  35. #define bh_strcpy_s(dest, dlen, src) do { \
  36. int _ret = b_strcpy_s (dest, dlen, src); \
  37. (void)_ret; \
  38. bh_assert (_ret == 0); \
  39. } while (0)
  40. #endif