mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject incubator-mynewt-core git commit: json - Remove call to sscanf().
Date Fri, 19 May 2017 01:16:57 GMT
Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/master c7d7a0ebf -> c82ebd4b5


json - Remove call to sscanf().

The call to sscanf() was adding about 2kB of code.  Replace this with a
call to strtoul().


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/c82ebd4b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/c82ebd4b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/c82ebd4b

Branch: refs/heads/master
Commit: c82ebd4b5ba5fa55b16d494f1fb50c39022dbab4
Parents: c7d7a0e
Author: Christopher Collins <ccollins@apache.org>
Authored: Thu May 18 18:16:03 2017 -0700
Committer: Christopher Collins <ccollins@apache.org>
Committed: Thu May 18 18:16:44 2017 -0700

----------------------------------------------------------------------
 encoding/json/src/json_decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c82ebd4b/encoding/json/src/json_decode.c
----------------------------------------------------------------------
diff --git a/encoding/json/src/json_decode.c b/encoding/json/src/json_decode.c
index c1fcbb9..5fba8bd 100644
--- a/encoding/json/src/json_decode.c
+++ b/encoding/json/src/json_decode.c
@@ -344,7 +344,7 @@ json_internal_read_object(struct json_buffer *jb,
                 }
                 // Scroll back one
                 c = jb->jb_read_prev(jb);
-                (void)sscanf(uescape, "%04x", &u);
+                u = strtoul(uescape, NULL, 16);
                 *pval++ = (char)u;        /* will truncate values above 0xff */
                 break;
             default:                /* handles double quote and solidus */


Mime
View raw message