Annotation of embedaddon/php/Zend/zend_string.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:    +----------------------------------------------------------------------+
                      3:    | Zend Engine                                                          |
                      4:    +----------------------------------------------------------------------+
                      5:    | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
                      6:    +----------------------------------------------------------------------+
                      7:    | This source file is subject to version 2.00 of the Zend license,     |
                      8:    | that is bundled with this package in the file LICENSE, and is        | 
                      9:    | available through the world-wide-web at the following url:           |
                     10:    | http://www.zend.com/license/2_00.txt.                                |
                     11:    | If you did not receive a copy of the Zend license and are unable to  |
                     12:    | obtain it through the world-wide-web, please send a note to          |
                     13:    | license@zend.com so we can mail you a copy immediately.              |
                     14:    +----------------------------------------------------------------------+
                     15:    | Authors: Dmitry Stogov <dmitry@zend.com>                             |
                     16:    +----------------------------------------------------------------------+
                     17: */
                     18: 
                     19: /* $Id: $ */
                     20: 
                     21: #ifndef ZEND_STRING_H
                     22: #define ZEND_STRING_H
                     23: 
                     24: #include "zend.h"
                     25: 
                     26: ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
                     27: ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D);
                     28: ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D);
                     29: 
                     30: void zend_interned_strings_init(TSRMLS_D);
                     31: void zend_interned_strings_dtor(TSRMLS_D);
                     32: 
                     33: #ifndef ZTS
                     34: 
                     35: #define IS_INTERNED(s) \
                     36:        (((s) >= CG(interned_strings_start)) && ((s) < CG(interned_strings_end)))
                     37: 
                     38: #else
                     39: 
                     40: #define IS_INTERNED(s) \
                     41:        (0)
                     42: 
                     43: #endif
                     44: 
                     45: #define INTERNED_LEN(s) \
                     46:        (((Bucket*)(((char*)(s))-sizeof(Bucket)))->nKeyLength)
                     47: 
                     48: #define INTERNED_HASH(s) \
                     49:        (((Bucket*)(((char*)(s))-sizeof(Bucket)))->h)
                     50: 
                     51: #define str_efree(s) do { \
                     52:                if (!IS_INTERNED(s)) { \
                     53:                        efree((char*)s); \
                     54:                } \
                     55:        } while (0)
                     56: 
                     57: #define str_free(s) do { \
                     58:                if (!IS_INTERNED(s)) { \
                     59:                        free((char*)s); \
                     60:                } \
                     61:        } while (0)
                     62: 
                     63: #endif /* ZEND_STRING_H */
                     64: 
                     65: /*
                     66:  * Local variables:
                     67:  * tab-width: 4
                     68:  * c-basic-offset: 4
                     69:  * indent-tabs-mode: t
                     70:  * End:
                     71:  */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>