Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29731 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28911 invoked by uid 1010); 24 May 2007 23:50:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 28896 invoked from network); 24 May 2007 23:50:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 May 2007 23:50:24 -0000 Authentication-Results: pb1.pair.com header.from=martin.majlis@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=martin.majlis@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.162.237 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: martin.majlis@gmail.com X-Host-Fingerprint: 64.233.162.237 nz-out-0506.google.com Linux 2.4/2.6 Received: from [64.233.162.237] ([64.233.162.237:3918] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/6D-57693-CB426564 for ; Thu, 24 May 2007 19:50:23 -0400 Received: by nz-out-0506.google.com with SMTP id 34so218984nzf for ; Thu, 24 May 2007 16:50:17 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=iHldkhPgvGgi6xnJ/V9wJP3Bw2gklZtpgLpGW6a9H5c5PqUZHFZ5AjZvPdIRlVkb8FeK3aX6NJVXY1UYpXoY16RPR9Omun8nxXz6014PO1CWi2rSVjhGo9x/P6fw1uw/d8CD6eBVAaDqzdkJjgc4zPv+dHznoHfOdXlBp1DK+qg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=fgKNJW0TQZT1nphYOxpqzhHyFLkJB+dFBBhCDSiYSRomq5pnEnNJdGzM4/+Ye49ViEZo1F2j4DRai2JznynCmV6b3YPV7xR9Ciy3wl0Nuxp5kvTr388Ig+HpEJK/5M8mZ4RiRmkqrTnlUoPYbM7iwKgjeBctzhOG5xgqpP9BvPM= Received: by 10.115.33.1 with SMTP id l1mr1216204waj.1180050617073; Thu, 24 May 2007 16:50:17 -0700 (PDT) Received: by 10.115.16.13 with HTTP; Thu, 24 May 2007 16:50:17 -0700 (PDT) Message-ID: <717e56840705241650p3210b76do1e1a0ae28e7aad3d@mail.gmail.com> Date: Fri, 25 May 2007 01:50:17 +0200 To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: [PATCH] JSON_parser From: martin.majlis@gmail.com ("Martin Majlis") Just small refactoring. Replacing self-made function with functions from standard headers. Index: JSON_parser.c =================================================================== RCS file: /repository/php-src/ext/json/JSON_parser.c,v retrieving revision 1.1.2.8 diff -u -u -r1.1.2.8 JSON_parser.c --- JSON_parser.c 24 May 2007 22:37:59 -0000 1.1.2.8 +++ JSON_parser.c 24 May 2007 23:41:11 -0000 @@ -29,6 +29,8 @@ #include "JSON_parser.h" #include +#include +#include #define true 1 #define false 0 @@ -259,18 +261,10 @@ static int dehexchar(char c) { - if (c >= '0' && c <= '9') - { - return c - '0'; - } - else if (c >= 'A' && c <= 'F') - { - return c - ('A' - 10); - } - else if (c >= 'a' && c <= 'f') - { - return c - ('a' - 10); - } + if (isxdigit(c)) + { + return strtol(&c, NULL, 16); + } else { return -1;