xref: /PHP-5.5/ext/intl/intl_common.h (revision 9762609c)
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 
19 #ifndef INTL_COMMON_H
20 #define INTL_COMMON_H
21 /* Auxiliary macros */
22 
23 #include <php.h>
24 #include <unicode/utypes.h>
25 
26 #ifndef UBYTES
27 # define UBYTES(len) ((len) * sizeof(UChar))
28 #endif
29 
30 #ifndef eumalloc
31 # define eumalloc(size)  (UChar*)safe_emalloc(size, sizeof(UChar), 0)
32 #endif
33 
34 #ifndef eurealloc
35 # define eurealloc(ptr, size)  (UChar*)erealloc((ptr), size * sizeof(UChar))
36 #endif
37 
38 #define USIZE(data) sizeof((data))/sizeof(UChar)
39 #define UCHARS(len) ((len) / sizeof(UChar))
40 
41 #define INTL_Z_STRVAL_P(str) (UChar*) Z_STRVAL_P(str)
42 #define INTL_Z_STRLEN_P(str) UCHARS( Z_STRLEN_P(str) )
43 
44 #endif /* INTL_COMMON_H */
45