more explicit constant names
authorMichael Wallner <mike@php.net>
Thu, 30 Oct 2014 16:26:25 +0000 (17:26 +0100)
committerMichael Wallner <mike@php.net>
Thu, 6 Nov 2014 08:12:56 +0000 (09:12 +0100)
php_http_url.c
php_http_url.h
tests/urlparser006.phpt
tests/urlparser007.phpt

index 23dec9f..09f94ec 100644 (file)
@@ -384,7 +384,7 @@ static const char parse_xdigits[] = "0123456789ABCDEF";
 static size_t parse_mb(php_http_url_t *url, parse_mb_what_t what, const char *ptr, const char *end, const char *begin, zend_bool silent)
 {
        size_t consumed = 0;
-       zend_bool idn = (what == PARSE_HOSTINFO) && (url->flags & PHP_HTTP_URL_PARSE_IDN);
+       zend_bool idn = (what == PARSE_HOSTINFO) && (url->flags & PHP_HTTP_URL_PARSE_TOIDN);
 
        if (url->flags & PHP_HTTP_URL_PARSE_MBUTF8) {
                consumed = parse_mb_utf8(url, ptr, end, idn);
@@ -396,7 +396,7 @@ static size_t parse_mb(php_http_url_t *url, parse_mb_what_t what, const char *pt
 #endif
 
        if (consumed) {
-               if (!(url->flags & PHP_HTTP_URL_PARSE_PCTENC) || what == PARSE_HOSTINFO || what == PARSE_SCHEME) {
+               if (!(url->flags & PHP_HTTP_URL_PARSE_TOPCT) || what == PARSE_HOSTINFO || what == PARSE_SCHEME) {
                        PHP_HTTP_DUFF(consumed, url->buffer[url->offset++] = *ptr++);
                } else {
                        int i = 0;
@@ -596,7 +596,7 @@ static STATUS parse_hostinfo(php_http_url_t *url, const char *ptr)
        }
 
 #ifdef PHP_HTTP_HAVE_IDN
-       if (url->flags & PHP_HTTP_URL_PARSE_IDN) {
+       if (url->flags & PHP_HTTP_URL_PARSE_TOIDN) {
                char *idn = NULL;
                int rv = -1;
 
@@ -1209,9 +1209,9 @@ PHP_MINIT_FUNCTION(http_url)
 #endif
        zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_MBUTF8"), PHP_HTTP_URL_PARSE_MBUTF8 TSRMLS_CC);
 #ifdef PHP_HTTP_HAVE_IDN
-       zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_IDN"), PHP_HTTP_URL_PARSE_IDN TSRMLS_CC);
+       zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOIDN"), PHP_HTTP_URL_PARSE_TOIDN TSRMLS_CC);
 #endif
-       zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_PCTENC"), PHP_HTTP_URL_PARSE_PCTENC TSRMLS_CC);
+       zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOPCT"), PHP_HTTP_URL_PARSE_TOPCT TSRMLS_CC);
 
        return SUCCESS;
 }
index 3c2ff76..eaecdfa 100644 (file)
@@ -45,9 +45,9 @@ typedef struct php_http_url_part {
 /* parse utf8 multibyte sequences */
 #define PHP_HTTP_URL_PARSE_MBUTF8 0x002
 /* convert multibyte hostnames to IDNA */
-#define PHP_HTTP_URL_PARSE_IDN    0x010
+#define PHP_HTTP_URL_PARSE_TOIDN  0x010
 /* percent encode multibyte sequences in userinfo, path, query and fragment */
-#define PHP_HTTP_URL_PARSE_PCTENC 0x020
+#define PHP_HTTP_URL_PARSE_TOPCT  0x020
 
 typedef struct php_http_url {
        /* compatible to php_url, but do not use php_url_free() */
index c35a20f..72ee358 100644 (file)
@@ -4,9 +4,9 @@ url parser multibyte/locale/idna
 <?php
 include "skipif.inc";
 if (!defined("http\\Url::PARSE_MBLOC") or
-       !defined("http\\Url::PARSE_IDN") or
+       !defined("http\\Url::PARSE_TOIDN") or
        !stristr(setlocale(LC_CTYPE, NULL), ".utf")) {
-       die("skip need http\\Url::PARSE_MBLOC|http\\Url::PARSE_IDN support and LC_CTYPE=*.UTF-8");
+       die("skip need http\\Url::PARSE_MBLOC|http\\Url::PARSE_TOIDN support and LC_CTYPE=*.UTF-8");
 }
 ?>
 --FILE--
@@ -21,7 +21,7 @@ $urls = array(
 
 foreach ($urls as $url) {
        printf("\n%s\n", $url);
-       var_dump(http\Url::parse($url, http\Url::PARSE_MBLOC|http\Url::PARSE_IDN));
+       var_dump(http\Url::parse($url, http\Url::PARSE_MBLOC|http\Url::PARSE_TOIDN));
 }
 ?>
 DONE
index 702302b..518bb72 100644 (file)
@@ -3,8 +3,8 @@ url parser multibyte/utf-8/idna
 --SKIPIF--
 <?php
 include "skipif.inc";
-if (!defined("http\\Url::PARSE_IDN")) {
-       die("skip need http\\Url::PARSE_IDN support");
+if (!defined("http\\Url::PARSE_TOIDN")) {
+       die("skip need http\\Url::PARSE_TOIDN support");
 }
 ?>
 --FILE--
@@ -19,7 +19,7 @@ $urls = array(
 
 foreach ($urls as $url) {
        printf("\n%s\n", $url);
-       var_dump(http\Url::parse($url, http\Url::PARSE_MBUTF8|http\Url::PARSE_IDN));
+       var_dump(http\Url::parse($url, http\Url::PARSE_MBUTF8|http\Url::PARSE_TOIDN));
 }
 ?>
 DONE