You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/05/19 01:16:57 UTC
incubator-mynewt-core git commit: json - Remove call to sscanf().
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 <cc...@apache.org>
Authored: Thu May 18 18:16:03 2017 -0700
Committer: Christopher Collins <cc...@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 */