Changeset 991
- Timestamp:
- 2012-07-18T09:52:35+02:00 (10 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
config.m4 (modified) (1 diff)
-
config.w32 (modified) (1 diff)
-
xcache.h (modified) (2 diffs)
-
xcache/xc_compatibility.c (added)
-
xcache/xc_compatibility.h (added)
-
xcache/xc_sandbox.c (modified) (1 diff)
-
xcache/xc_sandbox.h (modified) (1 diff)
-
xcache/xc_utils.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/config.m4
r990 r991 29 29 xcache.c \ 30 30 xcache/xc_const_string.c \ 31 xcache/xc_compatibility.c \ 31 32 xcache/xc_lock.c \ 32 33 xcache/xc_mem.c \ -
trunk/config.w32
r990 r991 17 17 xcache.c \ 18 18 xcache/xc_const_string.c \ 19 xcache/xc_compatibility.c \ 19 20 xcache/xc_lock.c \ 20 21 xcache/xc_mem.c \ -
trunk/xcache.h
r987 r991 22 22 #include "xcache/xc_shm.h" 23 23 #include "xcache/xc_lock.h" 24 25 #if !defined(ZEND_ENGINE_2_4) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4 || PHP_MAJOR_VERSION > 5) 26 # define ZEND_ENGINE_2_4 27 #endif 28 #if !defined(ZEND_ENGINE_2_3) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 || defined(ZEND_ENGINE_2_4)) 29 # define ZEND_ENGINE_2_3 30 #endif 31 #if !defined(ZEND_ENGINE_2_2) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2 || defined(ZEND_ENGINE_2_3)) 32 # define ZEND_ENGINE_2_2 33 #endif 34 #if !defined(ZEND_ENGINE_2_1) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 || defined(ZEND_ENGINE_2_2)) 35 # define ZEND_ENGINE_2_1 36 #endif 37 38 #define NOTHING 39 /* ZendEngine code Switcher */ 40 #ifndef ZEND_ENGINE_2 41 # define ZESW(v1, v2) v1 42 #else 43 # define ZESW(v1, v2) v2 44 #endif 45 #ifdef ZEND_ENGINE_2_4 46 # define ZEND_24(pre24, v24) v24 47 #else 48 # define ZEND_24(pre24, v24) pre24 49 #endif 50 51 #ifdef do_alloca_with_limit 52 # define my_do_alloca(size, use_heap) do_alloca_with_limit(size, use_heap) 53 # define my_free_alloca(size, use_heap) free_alloca_with_limit(size, use_heap) 54 #elif defined(ALLOCA_FLAG) 55 # define my_do_alloca(size, use_heap) do_alloca(size, use_heap) 56 # define my_free_alloca(size, use_heap) free_alloca(size, use_heap) 57 #else 58 # define my_do_alloca(size, use_heap) do_alloca(size) 59 # define my_free_alloca(size, use_heap) free_alloca(size) 60 # define ALLOCA_FLAG(x) 61 #endif 62 #ifndef Z_ISREF 63 # define Z_ISREF(z) (z).is_ref 64 #endif 65 #ifndef Z_SET_ISREF 66 # define Z_SET_ISREF(z) (z).is_ref = 1 67 #endif 68 #ifndef Z_UNSET_ISREF 69 # define Z_UNSET_ISREF(z) (z).is_ref = 0 70 #endif 71 #ifndef Z_REFCOUNT 72 # define Z_REFCOUNT(z) (z).refcount 73 #endif 74 #ifndef Z_SET_REFCOUNT 75 # define Z_SET_REFCOUNT(z, rc) (z).refcount = rc 76 #endif 77 #ifndef IS_CONSTANT_TYPE_MASK 78 # define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX) 79 #endif 80 81 /* {{{ dirty fix for PHP 6 */ 82 #ifdef add_assoc_long_ex 83 static inline void my_add_assoc_long_ex(zval *arg, char *key, uint key_len, long value) 84 { 85 add_assoc_long_ex(arg, key, key_len, value); 86 } 87 # undef add_assoc_long_ex 88 # define add_assoc_long_ex my_add_assoc_long_ex 89 #endif 90 #ifdef add_assoc_bool_ex 91 static inline void my_add_assoc_bool_ex(zval *arg, char *key, uint key_len, zend_bool value) 92 { 93 add_assoc_bool_ex(arg, key, key_len, value); 94 } 95 # undef add_assoc_bool_ex 96 # define add_assoc_bool_ex my_add_assoc_bool_ex 97 #endif 98 #ifdef add_assoc_null_ex 99 static inline void my_add_assoc_null_ex(zval *arg, char *key, uint key_len) 100 { 101 add_assoc_null_ex(arg, key, key_len); 102 } 103 # undef add_assoc_null_ex 104 # define add_assoc_null_ex my_add_assoc_null_ex 105 #endif 106 107 #ifdef ZEND_ENGINE_2_4 108 # define Z_OP(op) (op) 109 # define Z_OP_CONSTANT(op) (op).literal->constant 110 # define Z_OP_TYPE(op) op##_##type 111 # define Z_OP_TYPEOF_TYPE zend_uchar 112 113 # define Z_CLASS_INFO(className) (className).info.user 114 #else 115 # define Z_OP(op) (op).u 116 # define Z_OP_CONSTANT(op) (op).u.constant 117 # define Z_OP_TYPE(op) (op).op_type 118 # define Z_OP_TYPEOF_TYPE int 119 typedef znode znode_op; 120 121 # define Z_CLASS_INFO(className) (className) 122 #endif 123 124 /* }}} */ 125 126 /* unicode */ 127 #ifdef IS_UNICODE 128 # define UNISW(text, unicode) unicode 129 #else 130 # define UNISW(text, unicode) text 131 #endif 132 #define BUCKET_KEY_SIZE(b) \ 133 (UNISW( \ 134 (b)->nKeyLength, \ 135 ((b)->key.type == IS_UNICODE) \ 136 ? UBYTES(b->nKeyLength) \ 137 : b->nKeyLength \ 138 )) 139 #define BUCKET_KEY(b) (UNISW((b)->arKey, (b)->key.arKey)) 140 #define BUCKET_KEY_S(b) ZSTR_S(BUCKET_KEY(b)) 141 #define BUCKET_KEY_U(b) ZSTR_U(BUCKET_KEY(b)) 142 #define BUCKET_KEY_TYPE(b) (UNISW(IS_STRING, (b)->key.type)) 143 #ifdef IS_UNICODE 144 # define BUCKET_HEAD_SIZE(b) XtOffsetOf(Bucket, key.arKey) 145 #else 146 # define BUCKET_HEAD_SIZE(b) XtOffsetOf(Bucket, arKey) 147 #endif 148 149 #ifdef ZEND_ENGINE_2_4 150 # define BUCKET_SIZE(b) (sizeof(Bucket) + BUCKET_KEY_SIZE(b)) 151 #else 152 # define BUCKET_SIZE(b) (BUCKET_HEAD_SIZE(b) + BUCKET_KEY_SIZE(b)) 153 #endif 154 155 #ifndef IS_UNICODE 156 typedef char *zstr; 157 typedef const char *const_zstr; 158 #ifdef ZEND_ENGINE_2_4 159 typedef const char *const24_zstr; 160 typedef const char *const24_str; 161 #else 162 typedef char *const24_zstr; 163 typedef char *const24_str; 164 #endif 165 166 # define ZSTR_S(s) (s) 167 # define ZSTR_U(s) (s) 168 # define ZSTR_V(s) (s) 169 # define ZSTR_PS(s) (s) 170 # define ZSTR_PU(s) (s) 171 # define ZSTR_PV(s) (s) 172 #else 173 typedef const zstr const_zstr; 174 # define ZSTR_S(zs) ((zs).s) 175 # define ZSTR_U(zs) ((zs).u) 176 # define ZSTR_V(zs) ((zs).v) 177 # define ZSTR_PS(pzs) ((pzs)->s) 178 # define ZSTR_PU(pzs) ((pzs)->u) 179 # define ZSTR_PV(pzs) ((pzs)->v) 180 #endif 181 182 #ifndef ZSTR 183 # define ZSTR(s) (s) 184 #endif 185 186 #ifndef Z_UNIVAL 187 # define Z_UNIVAL(zval) (zval).value.str.val 188 # define Z_UNILEN(zval) (zval).value.str.len 189 #endif 190 191 /* {{{ u hash wrapper */ 192 #ifndef IS_UNICODE 193 # define zend_u_hash_add(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \ 194 zend_hash_add(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, pData, nDataSize, pDest) 195 196 # define zend_u_hash_quick_add(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \ 197 zend_hash_quick_add(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, h, pData, nDataSize, pDest) 198 199 # define zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \ 200 zend_hash_update(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, pData, nDataSize, pDest) 201 202 # define zend_u_hash_quick_update(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \ 203 zend_hash_quick_update(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, h, pData, nDataSize, pDest) 204 205 # define zend_u_hash_find(ht, type, arKey, nKeyLength, pData) \ 206 zend_hash_find(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, pData) 207 208 # define zend_u_hash_quick_find(ht, type, arKey, nKeyLength, h, pData) \ 209 zend_hash_quick_find(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, h, pData) 210 211 # define zend_u_hash_exists(ht, type, arKey, nKeyLength) \ 212 zend_hash_exists(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength) 213 214 # define add_u_assoc_zval_ex(arg, type, key, key_len, value) \ 215 add_assoc_zval_ex(arg, key, key_len, value) 216 217 # define zend_u_is_auto_global(type, name, name_len) \ 218 zend_is_auto_global(name, name_len) 219 #endif 220 /* }}} */ 221 24 #include "xcache/xc_compatibility.h" 222 25 223 26 #define ECALLOC_N(x, n) ((x) = ecalloc(n, sizeof((x)[0]))) 224 27 #define ECALLOC_ONE(x) ECALLOC_N(x, 1) 225 226 227 28 228 29 typedef ulong xc_hash_value_t; … … 232 33 xc_hash_value_t mask; 233 34 } xc_hash_t; 234 235 /* the class entry type to be stored in class_table */236 typedef ZESW(zend_class_entry, zend_class_entry*) xc_cest_t;237 238 /* xc_cest_t to (zend_class_entry*) */239 #define CestToCePtr(st) (ZESW(\240 &(st), \241 st \242 ) )243 244 /* ZCEP=zend class entry ptr */245 #define ZCEP_REFCOUNT_PTR(pce) (ZESW( \246 (pce)->refcount, \247 &((pce)->refcount) \248 ))249 250 #define ZCE_REFCOUNT_PTR(ce) ZCE_REFCOUNT_PTR(&ce)251 35 252 36 typedef zend_op_array *(zend_compile_file_t)(zend_file_handle *h, int type TSRMLS_DC); -
trunk/xcache/xc_sandbox.c
r990 r991 434 434 #endif 435 435 436 #ifndef ZEND_ENGINE_2_3437 #include "ext/standard/php_string.h"438 size_t xc_dirname(char *path, size_t len) /* {{{ */439 {440 #ifdef ZEND_ENGINE_2441 return php_dirname(path, len);442 #else443 php_dirname(path, len);444 return strlen(path);445 #endif446 }447 /* }}} */448 449 long xc_atol(const char *str, int str_len) /* {{{ */450 {451 long retval;452 453 if (!str_len) {454 str_len = strlen(str);455 }456 457 retval = strtol(str, NULL, 0);458 if (str_len > 0) {459 switch (str[str_len - 1]) {460 case 'g':461 case 'G':462 retval *= 1024;463 /* break intentionally missing */464 case 'm':465 case 'M':466 retval *= 1024;467 /* break intentionally missing */468 case 'k':469 case 'K':470 retval *= 1024;471 break;472 }473 }474 475 return retval;476 }477 /* }}} */478 479 #endif480 481 436 /* init/destroy */ 482 437 int xc_util_init(int module_number TSRMLS_DC) /* {{{ */ -
trunk/xcache/xc_sandbox.h
r989 r991 5 5 #pragma once 6 6 #endif // _MSC_VER > 1000 7 8 /* Purpose: run specified function in compiler sandbox, restore everything to previous state after it returns 9 */ 7 10 8 11 /* return op_array to install */ -
trunk/xcache/xc_utils.h
r990 r991 49 49 void xc_copy_internal_zend_constants(HashTable *target, HashTable *source); 50 50 #endif 51 52 #ifndef ZEND_ENGINE_2_353 size_t xc_dirname(char *path, size_t len);54 #define zend_dirname xc_dirname55 long xc_atol(const char *str, int len);56 #define zend_atol xc_atol57 #endif
Note: See TracChangeset
for help on using the changeset viewer.

