intl_common.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | http://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Authors: Vadim Savchuk <vsavchuk@productengine.com> |
  14. | Dmitry Lakhtyuk <dlakhtyuk@productengine.com> |
  15. | Stanislav Malyshev <stas@zend.com> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef INTL_COMMON_H
  19. #define INTL_COMMON_H
  20. /* Auxiliary macros */
  21. #include <php.h>
  22. #include <unicode/utypes.h>
  23. #ifndef UBYTES
  24. # define UBYTES(len) ((len) * sizeof(UChar))
  25. #endif
  26. #ifndef eumalloc
  27. # define eumalloc(size) (UChar*)safe_emalloc(size, sizeof(UChar), 0)
  28. #endif
  29. #ifndef eurealloc
  30. # define eurealloc(ptr, size) (UChar*)erealloc((ptr), size * sizeof(UChar))
  31. #endif
  32. #define USIZE(data) sizeof((data))/sizeof(UChar)
  33. #define UCHARS(len) ((len) / sizeof(UChar))
  34. #define INTL_Z_STRVAL_P(str) (UChar*) Z_STRVAL_P(str)
  35. #define INTL_Z_STRLEN_P(str) UCHARS( Z_STRLEN_P(str) )
  36. #endif /* INTL_COMMON_H */