zstd_common.c 1.7 KB

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