|
Revision 991, 0.7 KB
(checked in by moo, 10 months ago)
|
|
refactor: split compatibility
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | #include "xc_compatibility.h" |
|---|
| 2 | |
|---|
| 3 | #ifndef ZEND_ENGINE_2_3 |
|---|
| 4 | #include "ext/standard/php_string.h" |
|---|
| 5 | size_t xc_dirname(char *path, size_t len) /* {{{ */ |
|---|
| 6 | { |
|---|
| 7 | #ifdef ZEND_ENGINE_2 |
|---|
| 8 | return php_dirname(path, len); |
|---|
| 9 | #else |
|---|
| 10 | php_dirname(path, len); |
|---|
| 11 | return strlen(path); |
|---|
| 12 | #endif |
|---|
| 13 | } |
|---|
| 14 | /* }}} */ |
|---|
| 15 | |
|---|
| 16 | long xc_atol(const char *str, int str_len) /* {{{ */ |
|---|
| 17 | { |
|---|
| 18 | long retval; |
|---|
| 19 | |
|---|
| 20 | if (!str_len) { |
|---|
| 21 | str_len = strlen(str); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | retval = strtol(str, NULL, 0); |
|---|
| 25 | if (str_len > 0) { |
|---|
| 26 | switch (str[str_len - 1]) { |
|---|
| 27 | case 'g': |
|---|
| 28 | case 'G': |
|---|
| 29 | retval *= 1024; |
|---|
| 30 | /* break intentionally missing */ |
|---|
| 31 | case 'm': |
|---|
| 32 | case 'M': |
|---|
| 33 | retval *= 1024; |
|---|
| 34 | /* break intentionally missing */ |
|---|
| 35 | case 'k': |
|---|
| 36 | case 'K': |
|---|
| 37 | retval *= 1024; |
|---|
| 38 | break; |
|---|
| 39 | } |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | return retval; |
|---|
| 43 | } |
|---|
| 44 | /* }}} */ |
|---|
| 45 | #endif |
|---|