zstd_common.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under both the BSD-style license (found in the
  6. * LICENSE file in the root directory of this source tree) and the GPLv2 (found
  7. * in the COPYING file in the root directory of this source tree).
  8. * You may select, at your option, one of the above-listed licenses.
  9. */
  10. /*-*************************************
  11. * Dependencies
  12. ***************************************/
  13. #define ZSTD_DEPS_NEED_MALLOC
  14. #include "error_private.h"
  15. #include "zstd_internal.h"
  16. /*-****************************************
  17. * Version
  18. ******************************************/
  19. unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; }
  20. const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; }
  21. /*-****************************************
  22. * ZSTD Error Management
  23. ******************************************/
  24. #undef ZSTD_isError /* defined within zstd_internal.h */
  25. /*! ZSTD_isError() :
  26. * tells if a return value is an error code
  27. * symbol is required for external callers */
  28. unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
  29. /*! ZSTD_getErrorName() :
  30. * provides error code string from function result (useful for debugging) */
  31. const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); }
  32. /*! ZSTD_getError() :
  33. * convert a `size_t` function result into a proper ZSTD_errorCode enum */
  34. ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }
  35. /*! ZSTD_getErrorString() :
  36. * provides error code string from enum */
  37. const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); }