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 23dec9f1968aa9b9964ed9339742dd92ecd9377a..09f94ec30494a549215a62f6e668c6d12cfa7fff 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 3c2ff764beb878ca7039fff701262112d48515a0..eaecdfa8ace9debe375bacdec758c780d21e9f92 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 c35a20ff0404047d7fd9b664acf018e4a4b58fcc..72ee3580ae360e1c0c7172c795dbf885c45b4a22 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 702302b4be9075a876d04057bb664c45eca8e60f..518bb725671c141c47bd0459036c956df223558f 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