apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1835367 - /apr/apr-util/branches/1.7.x/json/apr_json_decode.c
Date Sun, 08 Jul 2018 17:28:43 GMT
Author: minfrin
Date: Sun Jul  8 17:28:43 2018
New Revision: 1835367

URL: http://svn.apache.org/viewvc?rev=1835367&view=rev
Log:
Backport r1835366.

Remove redundant checks, trailing garbage is caught elsewhere.

Modified:
    apr/apr-util/branches/1.7.x/json/apr_json_decode.c

Modified: apr/apr-util/branches/1.7.x/json/apr_json_decode.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/json/apr_json_decode.c?rev=1835367&r1=1835366&r2=1835367&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/json/apr_json_decode.c (original)
+++ apr/apr-util/branches/1.7.x/json/apr_json_decode.c Sun Jul  8 17:28:43 2018
@@ -519,18 +519,12 @@ static apr_status_t apr_json_decode_bool
     if (self->p >= self->e)
         return APR_EOF;
 
-    if (self->e - self->p >= 4 && strncmp("true", self->p, 4) == 0 &&
-        (self->p == self->e ||
-                (!isalnum(((unsigned char *)self->p)[4]) &&
-                        ((unsigned char *)self->p)[4] != '_'))) {
+    if (self->e - self->p >= 4 && strncmp("true", self->p, 4) == 0) {
         self->p += 4;
         *retval = 1;
         return APR_SUCCESS;
     }
-    else if (self->e - self->p >= 5 && strncmp("false", self->p, 5) ==
0 &&
-             (self->p == self->e ||
-                     (!isalnum(((unsigned char *)self->p)[5]) &&
-                             ((unsigned char *)self->p)[5] != '_'))) {
+    else if (self->e - self->p >= 5 && strncmp("false", self->p, 5) ==
0) {
         self->p += 5;
         *retval = 0;
         return APR_SUCCESS;
@@ -678,10 +672,7 @@ out:
 
 static apr_status_t apr_json_decode_null(apr_json_scanner_t * self)
 {
-    if (self->e - self->p >= 4 && strncmp("null", self->p, 4) == 0 &&
-        (self->p == self->e ||
-                (!isalnum(((unsigned char *)self->p)[4]) &&
-                        ((unsigned char *)self->p)[4] != '_'))) {
+    if (self->e - self->p >= 4 && strncmp("null", self->p, 4) == 0) {
         self->p += 4;
         return APR_SUCCESS;
     }



Mime
View raw message