move and add back compatibile function to utils.c
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@671 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
parent
e573fb3161
commit
315914c5d4
40
utils.c
40
utils.c
|
@ -920,3 +920,43 @@ int xc_trace(const char *fmt, ...) /* {{{ */
|
|||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifndef ZEND_ENGINE_2_3
|
||||
size_t zend_dirname(char *path, size_t len) /* {{{ */
|
||||
{
|
||||
php_dirname(path, len);
|
||||
return strlen(path);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
long zend_atol(const char *str, int str_len) /* {{{ */
|
||||
{
|
||||
long retval;
|
||||
|
||||
if (!str_len) {
|
||||
str_len = strlen(str);
|
||||
}
|
||||
|
||||
retval = strtol(str, NULL, 0);
|
||||
if (str_len > 0) {
|
||||
switch (str[str_len - 1]) {
|
||||
case 'g':
|
||||
case 'G':
|
||||
retval *= 1024;
|
||||
/* break intentionally missing */
|
||||
case 'm':
|
||||
case 'M':
|
||||
retval *= 1024;
|
||||
/* break intentionally missing */
|
||||
case 'k':
|
||||
case 'K':
|
||||
retval *= 1024;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
|
5
utils.h
5
utils.h
|
@ -133,6 +133,11 @@ void xc_zend_constant_dtor(zend_constant *c);
|
|||
void xc_copy_internal_zend_constants(HashTable *target, HashTable *source);
|
||||
#endif
|
||||
|
||||
#ifndef ZEND_ENGINE_2_3
|
||||
size_t zend_dirname(char *path, size_t len);
|
||||
long zend_atol(const char *str, int len);
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
zend_uint size;
|
||||
zend_uint cnt;
|
||||
|
|
8
xcache.c
8
xcache.c
|
@ -37,14 +37,6 @@
|
|||
#include "opcode_spec.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef ZEND_ENGINE_2_3
|
||||
ZEND_DLEXPORT size_t zend_dirname(char *path, size_t len)
|
||||
{
|
||||
php_dirname(path, len);
|
||||
return strlen(path);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > pentry->ctime + (pentry)->ttl)
|
||||
#define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0)
|
||||
#define LOCK(x) xc_lock(x->lck)
|
||||
|
|
4
xcache.h
4
xcache.h
|
@ -63,10 +63,6 @@
|
|||
# define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX)
|
||||
#endif
|
||||
|
||||
#ifndef ZEND_ENGINE_2_3
|
||||
#define zend_dirname(path, len) xc_dirname(path, len)
|
||||
#endif
|
||||
|
||||
/* {{{ dirty fix for PHP 6 */
|
||||
#ifdef add_assoc_long_ex
|
||||
static inline void my_add_assoc_long_ex(zval *arg, char *key, uint key_len, long value)
|
||||
|
|
Loading…
Reference in New Issue