diff options
author | Sara Golemon <pollita@php.net> | 2017-07-15 07:51:49 -0400 |
---|---|---|
committer | Sara Golemon <pollita@php.net> | 2017-07-16 17:01:20 -0400 |
commit | 3de82a0349b3c4942690c9b04d6e4a7ecdca2da9 (patch) | |
tree | 41b75e1ccd696a108c0bb21d4267021b4904048e | |
parent | 90ae2aec8c454020a7e658c98e8fc39496dc2393 (diff) | |
download | php-git-3de82a0349b3c4942690c9b04d6e4a7ecdca2da9.tar.gz |
Provide zend_string wrappers for php_base64_(en|de)code
Also pull existing php_base64_decode() proxy out to an inline.
Bump PHP_API_VERSION for ABI change.
-rw-r--r-- | ext/standard/base64.c | 6 | ||||
-rw-r--r-- | ext/standard/base64.h | 12 | ||||
-rw-r--r-- | main/php.h | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 5ba69c4784..4a4cbe19c0 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -127,12 +127,6 @@ void php_base64_init(void) */ /* }}} */ -PHPAPI zend_string *php_base64_decode(const unsigned char *str, size_t length) /* {{{ */ -{ - return php_base64_decode_ex(str, length, 0); -} -/* }}} */ - PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, zend_bool strict) /* {{{ */ { const unsigned char *current = str; diff --git a/ext/standard/base64.h b/ext/standard/base64.h index 77d2da9a74..1fa901b9ce 100644 --- a/ext/standard/base64.h +++ b/ext/standard/base64.h @@ -25,8 +25,18 @@ PHP_FUNCTION(base64_decode); PHP_FUNCTION(base64_encode); PHPAPI extern zend_string *php_base64_encode(const unsigned char *, size_t); +static inline zend_string *php_base64_encode_str(const zend_string *str) { + return php_base64_encode((const unsigned char*)(ZSTR_VAL(str)), ZSTR_LEN(str)); +} + PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, size_t, zend_bool); -PHPAPI extern zend_string *php_base64_decode(const unsigned char *, size_t); + +static inline zend_string *php_base64_decode(const unsigned char *str, size_t len) { + return php_base64_decode_ex(str, len, 0); +} +static inline zend_string *php_base64_decode_str(const zend_string *str) { + return php_base64_decode_ex((const unsigned char*)(ZSTR_VAL(str)), ZSTR_LEN(str), 0); +} #endif /* BASE64_H */ diff --git a/main/php.h b/main/php.h index 53926d2321..edf810d9b4 100644 --- a/main/php.h +++ b/main/php.h @@ -26,7 +26,7 @@ #include <dmalloc.h> #endif -#define PHP_API_VERSION 20160731 +#define PHP_API_VERSION 20170715 #define PHP_HAVE_STREAMS #define YYDEBUG 0 #define PHP_DEFAULT_CHARSET "UTF-8" |