json2tsv, branch HEADJSON to TSV converter
66e7e402f861efe9d8853569e67a4bbaee877fc92024-08-05T10:05:34Z2024-08-05T10:05:34Zbump version to 1.2Hiltjo Posthumahiltjo@codemadness.orgcommit 66e7e402f861efe9d8853569e67a4bbaee877fc9
parent ac68c8941305cce69e5659123cffab04f6736d8a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 5 Aug 2024 12:05:34 +0200
bump version to 1.2
ac68c8941305cce69e5659123cffab04f6736d8a2024-08-05T10:05:23Z2024-08-05T10:05:23Zbump LICENSE yearHiltjo Posthumahiltjo@codemadness.orgcommit ac68c8941305cce69e5659123cffab04f6736d8a
parent f689b5a0a309659de177c06bed733a0411f6ab02
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 5 Aug 2024 12:05:23 +0200
bump LICENSE year
f689b5a0a309659de177c06bed733a0411f6ab022024-08-05T10:00:37Z2024-08-05T10:00:37Zfix: reset state for expecting key string in objectsHiltjo Posthumahiltjo@codemadness.orgcommit f689b5a0a309659de177c06bed733a0411f6ab02
parent 137d638b66af74f1547584a560ae7a90875b4bf1
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 5 Aug 2024 12:00:37 +0200
fix: reset state for expecting key string in objects
Fixes an issue with the state machine still expecting a string to be an object
key, even after an (empty) object has been parsed.
This state is kept in the iskey variable, so reset it.
This happens for example with empty objects {}.
Test-case:
{"test":[["a",{},"b"]]}
Issue reported by Ben Collver, thanks!
137d638b66af74f1547584a560ae7a90875b4bf12023-05-25T20:42:04Z2023-05-25T20:42:04Zbump version to 1.1Hiltjo Posthumahiltjo@codemadness.orgcommit 137d638b66af74f1547584a560ae7a90875b4bf1
parent 705f468584d0c425b6871a6e1f894e4c7aad0993
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 25 May 2023 22:42:04 +0200
bump version to 1.1
705f468584d0c425b6871a6e1f894e4c7aad09932023-05-15T16:47:02Z2023-05-15T16:47:02Zfix typoHiltjo Posthumahiltjo@codemadness.orgcommit 705f468584d0c425b6871a6e1f894e4c7aad0993
parent 8ec8c8f26da6e20e58150a5b9e611ec651445469
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 15 May 2023 18:47:02 +0200
fix typo
8ec8c8f26da6e20e58150a5b9e611ec6514454692023-05-14T21:32:19Z2023-05-14T21:32:19Zjson.h: _JSON_H_: macro name with an underscore is a reserved identifierHiltjo Posthumahiltjo@codemadness.orgcommit 8ec8c8f26da6e20e58150a5b9e611ec651445469
parent 658cf342ce46348def6651d715b404a40baadb4f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 14 May 2023 23:32:19 +0200
json.h: _JSON_H_: macro name with an underscore is a reserved identifier
Found with clang -Wreserved-macro-identifier
See also:
https://wiki.sei.cmu.edu/confluence/display/c/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier
658cf342ce46348def6651d715b404a40baadb4f2023-04-23T10:39:38Z2023-04-23T10:39:38Zadd a -u option: flush output after printing each value (unbuffered)Hiltjo Posthumahiltjo@codemadness.orgcommit 658cf342ce46348def6651d715b404a40baadb4f
parent 994b5ebefdc81372822b42917e254ee1b0728db0
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 23 Apr 2023 12:39:38 +0200
add a -u option: flush output after printing each value (unbuffered)
This works similar to the sed -u option.
Sometimes it can be useful to force flushing the data directly. For example for
streaming JSON data.
994b5ebefdc81372822b42917e254ee1b0728db02023-04-23T10:22:51Z2023-04-23T10:22:51Zfail early if creating a temporary file failedHiltjo Posthumahiltjo@codemadness.orgcommit 994b5ebefdc81372822b42917e254ee1b0728db0
parent 6bc2f0c4a81a8b4877385d396fac72e931a90e30
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 23 Apr 2023 12:22:51 +0200
fail early if creating a temporary file failed
6bc2f0c4a81a8b4877385d396fac72e931a90e302023-04-14T17:13:12Z2023-04-14T17:13:12Zjson.c: use ENOMEM instead of EOVERFLOWHiltjo Posthumahiltjo@codemadness.orgcommit 6bc2f0c4a81a8b4877385d396fac72e931a90e30
parent 3ee79e477e039f8028f1c47e253deeb8d293454a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 14 Apr 2023 19:13:12 +0200
json.c: use ENOMEM instead of EOVERFLOW
3ee79e477e039f8028f1c47e253deeb8d293454a2023-04-05T16:59:10Z2023-04-05T16:59:10Zfix uninitialized variable (typo from previous commits)Hiltjo Posthumahiltjo@codemadness.orgcommit 3ee79e477e039f8028f1c47e253deeb8d293454a
parent b58cef5c0b0297761836fd4ac0fd08f5a81f2eff
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 5 Apr 2023 18:59:10 +0200
fix uninitialized variable (typo from previous commits)
b58cef5c0b0297761836fd4ac0fd08f5a81f2eff2023-04-04T16:34:06Z2023-04-04T16:34:06Zbump LICENSE yearHiltjo Posthumahiltjo@codemadness.orgcommit b58cef5c0b0297761836fd4ac0fd08f5a81f2eff
parent 403d7765995d21fbe24fda7318e8ac85c87bd4b1
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 4 Apr 2023 18:34:06 +0200
bump LICENSE year
403d7765995d21fbe24fda7318e8ac85c87bd4b12023-04-04T16:13:10Z2023-04-04T16:31:57Zjson.c: add len argument to callbackHiltjo Posthumahiltjo@codemadness.orgcommit 403d7765995d21fbe24fda7318e8ac85c87bd4b1
parent 55e9552c536fcb18f28d6742cfbec3ae10766473
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 4 Apr 2023 18:13:10 +0200
json.c: add len argument to callback
Not important for json2tsv itself, but for other uses of json.{c,h} it saves a
strlen() call in some cases.
Note that NUL bytes (via \u0000 or so) are discarded in json.c codepointtoutf8().
55e9552c536fcb18f28d6742cfbec3ae107664732023-04-04T16:08:05Z2023-04-04T16:10:48Zroll own ISDIGIT() macro instead of ctype isdigit()Hiltjo Posthumahiltjo@codemadness.orgcommit 55e9552c536fcb18f28d6742cfbec3ae10766473
parent 1f9c82d7086b221cb7a16cb41c3f870f8b08a552
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 4 Apr 2023 18:08:05 +0200
roll own ISDIGIT() macro instead of ctype isdigit()
This ensures portable and consistent behaviour of checking a digit character.
1f9c82d7086b221cb7a16cb41c3f870f8b08a5522022-09-01T17:13:24Z2022-09-01T17:13:24Zbump version to 1.0Hiltjo Posthumahiltjo@codemadness.orgcommit 1f9c82d7086b221cb7a16cb41c3f870f8b08a552
parent fcf73ca5b42eb3ef32dc7d99d1b7bafa4a02df42
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 1 Sep 2022 19:13:24 +0200
bump version to 1.0
fcf73ca5b42eb3ef32dc7d99d1b7bafa4a02df422022-08-31T23:50:23Z2022-08-31T23:50:23Zjson2tsv.1: add simplified jaq example here tooHiltjo Posthumahiltjo@codemadness.orgcommit fcf73ca5b42eb3ef32dc7d99d1b7bafa4a02df42
parent c01b7afce194e126dd9d7db3965fe6209f052e76
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 1 Sep 2022 01:50:23 +0200
json2tsv.1: add simplified jaq example here too
c01b7afce194e126dd9d7db3965fe6209f052e762022-08-31T23:43:13Z2022-08-31T23:43:13Zjaq.1: small typo fixHiltjo Posthumahiltjo@codemadness.orgcommit c01b7afce194e126dd9d7db3965fe6209f052e76
parent 7c73ed4db155770fb3c42edd396b894b209bdf41
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 1 Sep 2022 01:43:13 +0200
jaq.1: small typo fix
7c73ed4db155770fb3c42edd396b894b209bdf412022-08-31T23:39:35Z2022-08-31T23:39:35Zjaq: small tweaks and code-styleHiltjo Posthumahiltjo@codemadness.orgcommit 7c73ed4db155770fb3c42edd396b894b209bdf41
parent 6c4f4766a6151180fafe4f5d8d7e396e2a0d1876
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 1 Sep 2022 01:39:35 +0200
jaq: small tweaks and code-style
6c4f4766a6151180fafe4f5d8d7e396e2a0d18762022-08-31T20:40:23Z2022-08-31T20:40:23Zjaq: use jaq in the usage, not the full path which is uglyHiltjo Posthumahiltjo@codemadness.orgcommit 6c4f4766a6151180fafe4f5d8d7e396e2a0d1876
parent 7a687c50f0dd18733249b3d6c553225ad85f9a3f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 31 Aug 2022 22:40:23 +0200
jaq: use jaq in the usage, not the full path which is ugly
7a687c50f0dd18733249b3d6c553225ad85f9a3f2022-08-31T20:11:56Z2022-08-31T20:11:56Zjson2tsv.1: reference jaq, not jtqHiltjo Posthumahiltjo@codemadness.orgcommit 7a687c50f0dd18733249b3d6c553225ad85f9a3f
parent faec67c1670631fcd8eaa7bfb9ac1f8f639b0621
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 31 Aug 2022 22:11:56 +0200
json2tsv.1: reference jaq, not jtq
faec67c1670631fcd8eaa7bfb9ac1f8f639b06212022-08-31T20:07:59Z2022-08-31T20:07:59Zjaq improvementsHiltjo Posthumahiltjo@codemadness.orgcommit faec67c1670631fcd8eaa7bfb9ac1f8f639b0621
parent 45d005ecfcbc9c6735e9ced2e9f9d31cd6cfe0ce
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 31 Aug 2022 22:07:59 +0200
jaq improvements
* simplify: make awk expressions mandatory and don't list the same format as
json2tsv. If it is wanted just use json2tsv directly.
* use $* (not the array $@) to assign to a string, noticed by shellcheck.
* simplify: option parsing, allow using "-" as the start of an expression
(except "-n").
* set an EXIT trap to really make sure the temporary file is removed.
* improve documentation and add more details.
45d005ecfcbc9c6735e9ced2e9f9d31cd6cfe0ce2022-08-30T22:21:47Z2022-08-30T22:22:39Zrename jtq to jaqHiltjo Posthumahiltjo@codemadness.orgcommit 45d005ecfcbc9c6735e9ced2e9f9d31cd6cfe0ce
parent 607615a6d80ffa57f81aca02f77ae94960828d63
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 31 Aug 2022 00:21:47 +0200
rename jtq to jaq
607615a6d80ffa57f81aca02f77ae94960828d632022-08-30T18:20:38Z2022-08-30T18:30:02Zadd jtq: a convenience wrapper scriptHiltjo Posthumahiltjo@codemadness.orgcommit 607615a6d80ffa57f81aca02f77ae94960828d63
parent e2eeb2664324786e1a51e0ce64dbe03eeeff8346
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 30 Aug 2022 20:20:38 +0200
add jtq: a convenience wrapper script
It wraps json2tsv, sets options for handling JSON data in a lossless manner and
uses awk as a "query language".
e2eeb2664324786e1a51e0ce64dbe03eeeff83462022-05-02T18:16:47Z2022-05-02T18:16:47Zjson2tsv.1: properly escape backslashesHiltjo Posthumahiltjo@codemadness.orgcommit e2eeb2664324786e1a51e0ce64dbe03eeeff8346
parent 2a02e40c0df8ea64f7cb59f15b867cdb1d9f6506
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 2 May 2022 20:16:47 +0200
json2tsv.1: properly escape backslashes
From the mdoc(7) extended introduction:
>To output a backslash, use the escape sequence \e. Never use the escape
sequence \\ in any context.
https://mandoc.bsd.lv/mdoc/intro/escaping.html
(Thanks adc for reporting it to sfeed so it came to my attention).
2a02e40c0df8ea64f7cb59f15b867cdb1d9f65062022-04-02T16:31:38Z2022-04-02T16:31:38Zbump version to 0.9Hiltjo Posthumahiltjo@codemadness.orgcommit 2a02e40c0df8ea64f7cb59f15b867cdb1d9f6506
parent 47732754f1217ac0808253b8c531428d82ec3a18
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 2 Apr 2022 18:31:38 +0200
bump version to 0.9
47732754f1217ac0808253b8c531428d82ec3a182022-03-29T21:50:44Z2022-03-29T21:50:44Zdo not depend on C library locale for ctype functions/macrosHiltjo Posthumahiltjo@codemadness.orgcommit 47732754f1217ac0808253b8c531428d82ec3a18
parent 1ebc23030bb37e0f9399328ec3a6968e35758351
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 29 Mar 2022 23:50:44 +0200
do not depend on C library locale for ctype functions/macros
1ebc23030bb37e0f9399328ec3a6968e357583512022-03-28T16:42:11Z2022-03-28T16:42:11Zcompatibility: replace iscntrl with own ISCNTRL macroHiltjo Posthumahiltjo@codemadness.orgcommit 1ebc23030bb37e0f9399328ec3a6968e35758351
parent ca7aea61b3a593c782c7da48ec3e6552b47a698e
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 28 Mar 2022 18:42:11 +0200
compatibility: replace iscntrl with own ISCNTRL macro
It is unspecified if the C locale iscntrl is compatible with ASCII or not so
force it to be.
ca7aea61b3a593c782c7da48ec3e6552b47a698e2022-03-19T12:10:53Z2022-03-19T12:10:53Zimprove stream handling of read and write errorsHiltjo Posthumahiltjo@codemadness.orgcommit ca7aea61b3a593c782c7da48ec3e6552b47a698e
parent eb921bbad3f1120270014eaad9b2cba8a2958130
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 19 Mar 2022 13:10:53 +0100
improve stream handling of read and write errors
eb921bbad3f1120270014eaad9b2cba8a29581302022-02-21T16:16:38Z2022-02-21T16:16:38Zallow octal format and check the format a bit more strictHiltjo Posthumahiltjo@codemadness.orgcommit eb921bbad3f1120270014eaad9b2cba8a2958130
parent f022807e57f81d93643e6126487e37f47132b13e
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 21 Feb 2022 17:16:38 +0100
allow octal format and check the format a bit more strict
f022807e57f81d93643e6126487e37f47132b13e2022-02-21T16:16:18Z2022-02-21T16:16:18Zbump LICENSE yearHiltjo Posthumahiltjo@codemadness.orgcommit f022807e57f81d93643e6126487e37f47132b13e
parent e889775a6c3962a1d043c5316beb956cd8f0cb05
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 21 Feb 2022 17:16:18 +0100
bump LICENSE year
e889775a6c3962a1d043c5316beb956cd8f0cb052021-11-12T10:22:48Z2021-11-12T10:22:48Zjson: fix code that could have a side-effectsHiltjo Posthumahiltjo@codemadness.orgcommit e889775a6c3962a1d043c5316beb956cd8f0cb05
parent 5c614ee9fef3c53e5c046b5fc2af19253a2899b5
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 12 Nov 2021 11:22:48 +0100
json: fix code that could have a side-effects
It found a bug in the scc compiler.
5c614ee9fef3c53e5c046b5fc2af19253a2899b52021-10-26T00:17:11Z2021-10-26T00:17:11ZREADME: optimize the unescape() functionHiltjo Posthumahiltjo@codemadness.orgcommit 5c614ee9fef3c53e5c046b5fc2af19253a2899b5
parent d0b6a90a0f4acb6b3635025c899553aad208f400
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 26 Oct 2021 02:17:11 +0200
README: optimize the unescape() function
For bigger datasets use the -F and -R option though.
d0b6a90a0f4acb6b3635025c899553aad208f4002021-09-27T16:13:18Z2021-09-27T16:13:18Zbump version to 0.8Hiltjo Posthumahiltjo@codemadness.orgcommit d0b6a90a0f4acb6b3635025c899553aad208f400
parent baf6b755ae6ade6117900996c134a86b12ade3b6
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 27 Sep 2021 18:13:18 +0200
bump version to 0.8
baf6b755ae6ade6117900996c134a86b12ade3b62021-09-25T09:38:28Z2021-09-25T09:38:28Zimprove man page and documentation + fix a typo in a commentHiltjo Posthumahiltjo@codemadness.orgcommit baf6b755ae6ade6117900996c134a86b12ade3b6
parent fea1a2013f259f23798d9a611f783f25b4f7448d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 25 Sep 2021 11:38:28 +0200
improve man page and documentation + fix a typo in a comment
fea1a2013f259f23798d9a611f783f25b4f7448d2021-09-25T09:37:20Z2021-09-25T09:37:20Zprint \n or \t also when using -F or -RHiltjo Posthumahiltjo@codemadness.orgcommit fea1a2013f259f23798d9a611f783f25b4f7448d
parent 65ee8e6903bc3c072a2e55fdd2501b0296fbdf59
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 25 Sep 2021 11:37:20 +0200
print \n or \t also when using -F or -R
\n or \t is a control-character, but the intention of suppressing them by
default is to not mess with the terminal (-r can be used to enable it).
65ee8e6903bc3c072a2e55fdd2501b0296fbdf592021-09-25T09:36:12Z2021-09-25T09:36:12Zuse exitcode 3 for usage errorsHiltjo Posthumahiltjo@codemadness.orgcommit 65ee8e6903bc3c072a2e55fdd2501b0296fbdf59
parent 7c6507b10767029b3d4585e3e65d231f66fa904b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 25 Sep 2021 11:36:12 +0200
use exitcode 3 for usage errors
7c6507b10767029b3d4585e3e65d231f66fa904b2021-09-24T12:27:38Z2021-09-24T12:30:04Zoptimize printing the index of an array with the -n optionHiltjo Posthumahiltjo@codemadness.orgcommit 7c6507b10767029b3d4585e3e65d231f66fa904b
parent 18215ba6f1a9f2c76ffceded0670eb2b2f466792
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 24 Sep 2021 14:27:38 +0200
optimize printing the index of an array with the -n option
18215ba6f1a9f2c76ffceded0670eb2b2f4667922021-09-18T14:17:32Z2021-09-24T12:30:02Zadd -F and -R option to allow to specify a different field and record separatorHiltjo Posthumahiltjo@codemadness.orgcommit 18215ba6f1a9f2c76ffceded0670eb2b2f466792
parent 226d85203f7ea26dcc71c98e0fb7fe3ffb78176b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 18 Sep 2021 16:17:32 +0200
add -F and -R option to allow to specify a different field and record separator
226d85203f7ea26dcc71c98e0fb7fe3ffb78176b2021-09-23T16:31:00Z2021-09-24T12:11:35Zjson: optimize number parsing for large number datasetsHiltjo Posthumahiltjo@codemadness.orgcommit 226d85203f7ea26dcc71c98e0fb7fe3ffb78176b
parent 650481927d19d28d035d470bdedd2e2226e4dbd2
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 23 Sep 2021 18:31:00 +0200
json: optimize number parsing for large number datasets
Measured on OpenBSD and Voidlinux glibc (gcc and clang).
Not much difference on AMD Ryzen with GNUVoid Linux (glibc).
Tested and much difference on OpenBSD-current (laptop, older Intel CPU), 6.8
and 6.9 (older Intel Xeons).
Tested with json-testsuite, no differences (as intended).
650481927d19d28d035d470bdedd2e2226e4dbd22021-04-29T16:14:56Z2021-04-29T16:14:56Zbump version to 0.7Hiltjo Posthumahiltjo@codemadness.orgcommit 650481927d19d28d035d470bdedd2e2226e4dbd2
parent 770996c13b04532dacf3a190f57dd0c06ed4e7a7
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 29 Apr 2021 18:14:56 +0200
bump version to 0.7
770996c13b04532dacf3a190f57dd0c06ed4e7a72021-04-29T10:57:45Z2021-04-29T11:00:53Zseparate JSON2TSV_* CFLAGS, LDFLAGS, use unlocked I/O by defaultHiltjo Posthumahiltjo@codemadness.orgcommit 770996c13b04532dacf3a190f57dd0c06ed4e7a7
parent 917726e20fb722b0097e5be8a2f68ba385c58d66
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 29 Apr 2021 12:57:45 +0200
separate JSON2TSV_* CFLAGS, LDFLAGS, use unlocked I/O by default
917726e20fb722b0097e5be8a2f68ba385c58d662021-04-29T10:56:56Z2021-04-29T10:56:56Zjson.c: fix a gcc warningHiltjo Posthumahiltjo@codemadness.orgcommit 917726e20fb722b0097e5be8a2f68ba385c58d66
parent a6acda04e4f9f2285e126f7045b83bf7e2f8bf39
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 29 Apr 2021 12:56:56 +0200
json.c: fix a gcc warning
gcc -Wall -o json.o -c json.c
json.c: In function 'parsejson':
json.c:94: warning: missing braces around initializer
json.c:94: warning: (near initialization for 'nodes[0]')
a6acda04e4f9f2285e126f7045b83bf7e2f8bf392021-03-21T11:34:54Z2021-03-21T11:34:54ZREADME: add awk example function to unescape json2tsv outputHiltjo Posthumahiltjo@codemadness.orgcommit a6acda04e4f9f2285e126f7045b83bf7e2f8bf39
parent 84da1dac7041f1fc700cade27c55613a6f900de4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 21 Mar 2021 12:34:54 +0100
README: add awk example function to unescape json2tsv output
84da1dac7041f1fc700cade27c55613a6f900de42021-03-05T11:59:31Z2021-03-05T11:59:31ZLICENSE: bump yearHiltjo Posthumahiltjo@codemadness.orgcommit 84da1dac7041f1fc700cade27c55613a6f900de4
parent 88179a63c54bdc340781139fa91e3bd284bd6d73
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 5 Mar 2021 12:59:31 +0100
LICENSE: bump year
88179a63c54bdc340781139fa91e3bd284bd6d732021-01-23T15:13:47Z2021-01-23T15:13:47Zbump version to 0.6Hiltjo Posthumahiltjo@codemadness.orgcommit 88179a63c54bdc340781139fa91e3bd284bd6d73
parent b65bd5139faec35430d342dbce6c3b4bf802f4a8
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 23 Jan 2021 16:13:47 +0100
bump version to 0.6
b65bd5139faec35430d342dbce6c3b4bf802f4a82021-01-21T23:23:19Z2021-01-21T23:23:19Zjson.c: fix utf-16 surrogate pair rangeHiltjo Posthumahiltjo@codemadness.orgcommit b65bd5139faec35430d342dbce6c3b4bf802f4a8
parent 8128e7fa5d865ac7adff28e7ffb732f0b3b61f58
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 22 Jan 2021 00:23:19 +0100
json.c: fix utf-16 surrogate pair range
Test-case of a high codepoint: U+10FFFD.
Previously incorrect:
printf '%s' '["\udbff\udffd"]' | json2tsv | hexdump -C
00000000 09 61 09 0a 5b 5d 09 73 09 ed af bf ed bf bd 0a |.a..[].s........|
00000010
Now correct:
printf '%s' '["\udbff\udffd"]' | ./json2tsv | hexdump -C
00000000 09 61 09 0a 5b 5d 09 73 09 f4 8f bf bd 0a |.a..[].s......|
0000000e
8128e7fa5d865ac7adff28e7ffb732f0b3b61f582020-11-04T16:55:40Z2020-11-04T16:55:40Zjson.h: add #ifdef guardHiltjo Posthumahiltjo@codemadness.orgcommit 8128e7fa5d865ac7adff28e7ffb732f0b3b61f58
parent 58f7bb60f4e785121d30b808ce475407e4b95b5b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 4 Nov 2020 17:55:40 +0100
json.h: add #ifdef guard
58f7bb60f4e785121d30b808ce475407e4b95b5b2020-11-04T16:55:05Z2020-11-04T16:55:05ZMakefile: uninstall LICENSE, on install chmod $DOC filesHiltjo Posthumahiltjo@codemadness.orgcommit 58f7bb60f4e785121d30b808ce475407e4b95b5b
parent 5b92fe10218579d7dd0c725c043de425d4076a9c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 4 Nov 2020 17:55:05 +0100
Makefile: uninstall LICENSE, on install chmod $DOC files
Thanks adc!
5b92fe10218579d7dd0c725c043de425d4076a9c2020-06-21T16:02:24Z2020-06-21T16:02:24ZMakefile: tiny compatibility improvement for tar -cfHiltjo Posthumahiltjo@codemadness.orgcommit 5b92fe10218579d7dd0c725c043de425d4076a9c
parent df5cda00ba8ef98787d15a666cd06b1fcb336b4c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 21 Jun 2020 18:02:24 +0200
Makefile: tiny compatibility improvement for tar -cf
df5cda00ba8ef98787d15a666cd06b1fcb336b4c2020-06-10T12:38:45Z2020-06-10T12:38:45ZMakefile: improvementsHiltjo Posthumahiltjo@codemadness.orgcommit df5cda00ba8ef98787d15a666cd06b1fcb336b4c
parent 29d08288c8e16e76e408f2cab0729d7136b493fb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 10 Jun 2020 14:38:45 +0200
Makefile: improvements
Pointed out by quinq, thanks
* Use ar -rc (not ar rc) as defined in POSIX.
* Install license as documentation too.
29d08288c8e16e76e408f2cab0729d7136b493fb2020-06-01T10:15:09Z2020-06-01T10:15:09Zfix typoHiltjo Posthumahiltjo@codemadness.orgcommit 29d08288c8e16e76e408f2cab0729d7136b493fb
parent ee80731f6fa75e73aea2a30b4cf1f4bb939b6545
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 1 Jun 2020 12:15:09 +0200
fix typo
ee80731f6fa75e73aea2a30b4cf1f4bb939b65452020-02-23T19:35:42Z2020-02-23T19:35:42Zbump version to 0.5Hiltjo Posthumahiltjo@codemadness.orgcommit ee80731f6fa75e73aea2a30b4cf1f4bb939b6545
parent c91abbebb914af5ddac6f3d1c874a3b403172773
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 23 Feb 2020 20:35:42 +0100
bump version to 0.5
c91abbebb914af5ddac6f3d1c874a3b4031727732020-02-16T13:53:31Z2020-02-16T13:53:31Zsmall white-space / code-style fixHiltjo Posthumahiltjo@codemadness.orgcommit c91abbebb914af5ddac6f3d1c874a3b403172773
parent 2ba1ec15453197af2ef4fb5cf04157276fa70b67
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 16 Feb 2020 14:53:31 +0100
small white-space / code-style fix
2ba1ec15453197af2ef4fb5cf04157276fa70b672020-01-28T20:50:40Z2020-01-28T20:50:40Zcleanup some includesHiltjo Posthumahiltjo@codemadness.orgcommit 2ba1ec15453197af2ef4fb5cf04157276fa70b67
parent 27d9d1e28a0d8fac91491ff2b0bfe964c081cba5
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 28 Jan 2020 21:50:40 +0100
cleanup some includes
27d9d1e28a0d8fac91491ff2b0bfe964c081cba52020-01-21T19:06:46Z2020-01-21T19:06:46Zupdate LICENSE yearHiltjo Posthumahiltjo@codemadness.orgcommit 27d9d1e28a0d8fac91491ff2b0bfe964c081cba5
parent f4ae5c240dbe7ca52eb9b7a7ab0a94a4fe3b6f06
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 21 Jan 2020 20:06:46 +0100
update LICENSE year
f4ae5c240dbe7ca52eb9b7a7ab0a94a4fe3b6f062019-12-29T17:42:53Z2019-12-29T17:42:53Zshow usage on invalid flags or any argumentsHiltjo Posthumahiltjo@codemadness.orgcommit f4ae5c240dbe7ca52eb9b7a7ab0a94a4fe3b6f06
parent e569792c8bc41e19f1702ae57bbfbebc9fc64bff
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 29 Dec 2019 18:42:53 +0100
show usage on invalid flags or any arguments
e569792c8bc41e19f1702ae57bbfbebc9fc64bff2019-12-29T17:34:39Z2019-12-29T17:34:39Zrename TYPE_* to JSON_TYPE_*Hiltjo Posthumahiltjo@codemadness.orgcommit e569792c8bc41e19f1702ae57bbfbebc9fc64bff
parent cc245b50c91a1d3b3618773f289a3d4bb670df75
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 29 Dec 2019 18:34:39 +0100
rename TYPE_* to JSON_TYPE_*
cc245b50c91a1d3b3618773f289a3d4bb670df752019-11-12T00:22:56Z2019-11-12T00:22:56Zbump version to 0.4Hiltjo Posthumahiltjo@codemadness.orgcommit cc245b50c91a1d3b3618773f289a3d4bb670df75
parent 13f4f439171cba26e0afaee4fc7eb98a483877c2
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 12 Nov 2019 01:22:56 +0100
bump version to 0.4
13f4f439171cba26e0afaee4fc7eb98a483877c22019-11-12T00:15:52Z2019-11-12T00:15:52ZREADME: fix typoHiltjo Posthumahiltjo@codemadness.orgcommit 13f4f439171cba26e0afaee4fc7eb98a483877c2
parent e0b9a599b21a1e85950af9f3185989d21c630970
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 12 Nov 2019 01:15:52 +0100
README: fix typo
e0b9a599b21a1e85950af9f3185989d21c6309702019-11-09T15:19:45Z2019-11-09T15:19:45Zupdate READMEHiltjo Posthumahiltjo@codemadness.orgcommit e0b9a599b21a1e85950af9f3185989d21c630970
parent 33d5e77ed74ebe2ac9495ca3f4dbde493b26b69f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 9 Nov 2019 16:19:45 +0100
update README
- remove -n flag information. This is not something for the introduction, but
something for the manual and there is a -r flag now too.
- structure sections similar to the sfeed README.
- add list of build instructions.
- add list of dependencies and optional dependencies section.
- add author section.
33d5e77ed74ebe2ac9495ca3f4dbde493b26b69f2019-11-05T19:46:45Z2019-11-05T19:46:45Zadd -r flag to allow printing all control-charactersHiltjo Posthumahiltjo@codemadness.orgcommit 33d5e77ed74ebe2ac9495ca3f4dbde493b26b69f
parent a8950873f2e40fe767530b8e58b723c8b56abc33
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 5 Nov 2019 20:46:45 +0100
add -r flag to allow printing all control-characters
No performance change with -O2 or higher with gcc or clang using no flags set.
Minor tweaks:
- rename showindices to nflag variable.
- reword and improve formatting of man page.
- improve parsing of options.
a8950873f2e40fe767530b8e58b723c8b56abc332019-10-24T11:54:28Z2019-10-24T11:54:28Zbump version to 0.3Hiltjo Posthumahiltjo@codemadness.orgcommit a8950873f2e40fe767530b8e58b723c8b56abc33
parent b780768500f3466bea0d2f770fc379eb9cb78669
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 24 Oct 2019 13:54:28 +0200
bump version to 0.3
b780768500f3466bea0d2f770fc379eb9cb786692019-10-23T19:39:49Z2019-10-23T19:39:49Zoptimize whitespace checking for gcc optimizationHiltjo Posthumahiltjo@codemadness.orgcommit b780768500f3466bea0d2f770fc379eb9cb78669
parent e49c809209014c1ab4e7c6b0921d82a5cbae5feb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 23 Oct 2019 21:39:49 +0200
optimize whitespace checking for gcc optimization
Restores some performance. no difference for clang.
gcc 4.2.1
clang 8.0.1
e49c809209014c1ab4e7c6b0921d82a5cbae5feb2019-10-23T19:36:27Z2019-10-23T19:36:27Zdefine all "expected" stringsHiltjo Posthumahiltjo@codemadness.orgcommit e49c809209014c1ab4e7c6b0921d82a5cbae5feb
parent 29f995fe694b10e97eb61afa046de1915f0f97fb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 23 Oct 2019 21:36:27 +0200
define all "expected" strings
29f995fe694b10e97eb61afa046de1915f0f97fb2019-10-23T17:40:36Z2019-10-23T17:40:36Zremove check for types and depth of object key string that cannot happen anymoreHiltjo Posthumahiltjo@codemadness.orgcommit 29f995fe694b10e97eb61afa046de1915f0f97fb
parent b3cce42c19a31a92b232d9e6a2bdb973169a7878
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 23 Oct 2019 19:40:36 +0200
remove check for types and depth of object key string that cannot happen anymore
b3cce42c19a31a92b232d9e6a2bdb973169a78782019-10-23T17:40:17Z2019-10-23T17:40:17Zminor style changes, add some commentsHiltjo Posthumahiltjo@codemadness.orgcommit b3cce42c19a31a92b232d9e6a2bdb973169a7878
parent bb2e9c03c80acfe0a339c43b8d622713b14b8ea5
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 23 Oct 2019 19:40:17 +0200
minor style changes, add some comments
bb2e9c03c80acfe0a339c43b8d622713b14b8ea52019-10-23T17:34:59Z2019-10-23T17:34:59Zremove duplicate assignment of value, will be overwritten anywayHiltjo Posthumahiltjo@codemadness.orgcommit bb2e9c03c80acfe0a339c43b8d622713b14b8ea5
parent 42251415a957f095453b290a96bcf870632eb58d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 23 Oct 2019 19:34:59 +0200
remove duplicate assignment of value, will be overwritten anyway
42251415a957f095453b290a96bcf870632eb58d2019-10-23T17:07:17Z2019-10-23T17:07:17Zstylistic change: check EOF before strchr().Hiltjo Posthumahiltjo@codemadness.orgcommit 42251415a957f095453b290a96bcf870632eb58d
parent 33c1ceffbcb04f8a6970d04841175f96737942bb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 23 Oct 2019 19:07:17 +0200
stylistic change: check EOF before strchr().
should have no functional difference, but check EOF first
33c1ceffbcb04f8a6970d04841175f96737942bb2019-10-22T21:37:24Z2019-10-22T21:37:24Zfix regression: restore balanced nodes check for ,Hiltjo Posthumahiltjo@codemadness.orgcommit 33c1ceffbcb04f8a6970d04841175f96737942bb
parent 69c080a4b190ea29c0dd1ae008c84cbd0712068f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 22 Oct 2019 23:37:24 +0200
fix regression: restore balanced nodes check for ,
The EXPECT_END state contained ',' which did not check the depth.
reproduce:
echo '"test",' | json2tsv
This wrote nodes[-1].index++ and was treated as valid.
a primitive followed by , was also valid (incorrect), for example:
"true,"
EXPECT_END is "}]," All these states are checked now for the depth <= 0 so
remove the EXPECT_NOTHING state.
69c080a4b190ea29c0dd1ae008c84cbd0712068f2019-10-20T14:46:21Z2019-10-20T14:46:21Zjson: declare symbols to JSON parsing internals static (local)Hiltjo Posthumahiltjo@codemadness.orgcommit 69c080a4b190ea29c0dd1ae008c84cbd0712068f
parent 3877a663aff7b1a64e72717d5bb3f56b4ba46f99
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 20 Oct 2019 16:46:21 +0200
json: declare symbols to JSON parsing internals static (local)
3877a663aff7b1a64e72717d5bb3f56b4ba46f992019-10-20T13:01:22Z2019-10-20T13:01:22Zjson2tsv.1: document exit statusHiltjo Posthumahiltjo@codemadness.orgcommit 3877a663aff7b1a64e72717d5bb3f56b4ba46f99
parent 30f46f53a909c9d80b77ed3a5b2485d2f78ecc38
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 20 Oct 2019 15:01:22 +0200
json2tsv.1: document exit status
30f46f53a909c9d80b77ed3a5b2485d2f78ecc382019-10-20T12:35:25Z2019-10-20T12:35:25Zjson2tsv.1: update man page documentationHiltjo Posthumahiltjo@codemadness.orgcommit 30f46f53a909c9d80b77ed3a5b2485d2f78ecc38
parent 2f12ae56971af8acaa52357fe1042d37f71ffbd4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 20 Oct 2019 14:35:25 +0200
json2tsv.1: update man page documentation
2f12ae56971af8acaa52357fe1042d37f71ffbd42019-10-20T12:30:24Z2019-10-20T12:30:24ZimprovementsHiltjo Posthumahiltjo@codemadness.orgcommit 2f12ae56971af8acaa52357fe1042d37f71ffbd4
parent 9a85d6c5f69749ac71c690e5b4d36b8e70b15d16
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 20 Oct 2019 14:30:24 +0200
improvements
- separate into more precise JSON types: primitives to: bool, null, number.
- separate JSON code into a reusable "library": json.c.
- remove errstr from parsejson(): just return an error code for out-of-memory
and a JSON parse error. The tool returns exit code 2 when out-of-memory.
- much more strict JSON parsing for incorrect input.
- make primitives a fixed buffer. The longest size data for primitives are
numbers and cannot be long anyway.
- improve README example (reddit).
9a85d6c5f69749ac71c690e5b4d36b8e70b15d162019-10-15T20:28:13Z2019-10-15T20:28:13Zbump version to 0.2Hiltjo Posthumahiltjo@codemadness.orgcommit 9a85d6c5f69749ac71c690e5b4d36b8e70b15d16
parent 38f8dd3abd1ecbdf451ad9d98d707b09debe1c3a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 22:28:13 +0200
bump version to 0.2
38f8dd3abd1ecbdf451ad9d98d707b09debe1c3a2019-10-15T20:27:49Z2019-10-15T20:27:49Zminor comment line changeHiltjo Posthumahiltjo@codemadness.orgcommit 38f8dd3abd1ecbdf451ad9d98d707b09debe1c3a
parent d9837031a5640f6d55afd1cc4f370a54f1f6bdf0
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 22:27:49 +0200
minor comment line change
d9837031a5640f6d55afd1cc4f370a54f1f6bdf02019-10-15T20:21:30Z2019-10-15T20:21:30Zman page: improve wordingHiltjo Posthumahiltjo@codemadness.orgcommit d9837031a5640f6d55afd1cc4f370a54f1f6bdf0
parent 4e539a2a08ad3348e8c4c2331b550e9ad24d69d9
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 22:21:30 +0200
man page: improve wording
4e539a2a08ad3348e8c4c2331b550e9ad24d69d92019-10-15T20:14:19Z2019-10-15T20:14:19Zupdate/tweak comments about surrogate, shuffle one lineHiltjo Posthumahiltjo@codemadness.orgcommit 4e539a2a08ad3348e8c4c2331b550e9ad24d69d9
parent d8a06e34247a2219a62cb7b0d82218b87d155259
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 22:14:19 +0200
update/tweak comments about surrogate, shuffle one line
d8a06e34247a2219a62cb7b0d82218b87d1552592019-10-15T19:45:52Z2019-10-15T19:45:52Zremove this error typeHiltjo Posthumahiltjo@codemadness.orgcommit d8a06e34247a2219a62cb7b0d82218b87d155259
parent d9eb13696d70c0d87f13438cd9cb34d34102fb82
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 21:45:52 +0200
remove this error type
input:
]
produces this error, which is unclear anyway.
d9eb13696d70c0d87f13438cd9cb34d34102fb822019-10-15T17:00:17Z2019-10-15T17:00:17Zbump max node depth from 32 to 64Hiltjo Posthumahiltjo@codemadness.orgcommit d9eb13696d70c0d87f13438cd9cb34d34102fb82
parent 9f4ab639718e4351b02b4bde6035cd588c32b169
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 19:00:17 +0200
bump max node depth from 32 to 64
32 is already insanely high, but bump to 64 to be on the very safe side.
I Compared this value to a few other JSON parsers.
9f4ab639718e4351b02b4bde6035cd588c32b1692019-10-15T16:58:56Z2019-10-15T16:58:56Zhandle unescaped string and unexpected EOF and improve handling surrogatesHiltjo Posthumahiltjo@codemadness.orgcommit 9f4ab639718e4351b02b4bde6035cd588c32b169
parent f0b7f8935d41162e29c5a01f15273ba225909969
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 18:58:56 +0200
handle unescaped string and unexpected EOF and improve handling surrogates
.... handle UTF-16 surrogate code-point errors and try to recover gracefully, just
output the raw bytes.
f0b7f8935d41162e29c5a01f15273ba2259099692019-10-15T16:56:21Z2019-10-15T16:56:21Zseparate error for invalid array membersHiltjo Posthumahiltjo@codemadness.orgcommit f0b7f8935d41162e29c5a01f15273ba225909969
parent 0329ac9b10b3d47b509afca6f82078bf50b32480
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 18:56:21 +0200
separate error for invalid array members
error: "member, but not in an object/array"
example of such bad input:
1,2,3
0329ac9b10b3d47b509afca6f82078bf50b324802019-10-15T16:55:24Z2019-10-15T16:55:24Ztreat unknown escape char as an error nowHiltjo Posthumahiltjo@codemadness.orgcommit 0329ac9b10b3d47b509afca6f82078bf50b32480
parent d58761df609fb30dce860560b849f7f2d389e007
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 18:55:24 +0200
treat unknown escape char as an error now
d58761df609fb30dce860560b849f7f2d389e0072019-10-15T16:53:51Z2019-10-15T16:53:51Zallow primitive and string type on its own (without object or array)Hiltjo Posthumahiltjo@codemadness.orgcommit d58761df609fb30dce860560b849f7f2d389e007
parent 38d0984744efb248bfe773431d922a63cd09e0e3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 18:53:51 +0200
allow primitive and string type on its own (without object or array)
now valid:
1
true
null
"string"
38d0984744efb248bfe773431d922a63cd09e0e32019-10-15T16:50:21Z2019-10-15T16:50:21Zmake wrong parsing a wrong string a bit more logicalHiltjo Posthumahiltjo@codemadness.orgcommit 38d0984744efb248bfe773431d922a63cd09e0e3
parent 216c4f342f22413073cfa9a98cb069b93eb0ecb4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 18:50:21 +0200
make wrong parsing a wrong string a bit more logical
test:
{"a" "b"}
result:
handle as "ab" instead of ignoring "a"
{1"a"} is now:
"1a" (string) instead of "a"
216c4f342f22413073cfa9a98cb069b93eb0ecb42019-10-15T16:49:17Z2019-10-15T16:49:17Zallow 0x7f (DEL) inside strings (allowed in the RFC)Hiltjo Posthumahiltjo@codemadness.orgcommit 216c4f342f22413073cfa9a98cb069b93eb0ecb4
parent 03e5cd467dd7219175dc25fe821cea5e6d2a5520
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 18:49:17 +0200
allow 0x7f (DEL) inside strings (allowed in the RFC)
03e5cd467dd7219175dc25fe821cea5e6d2a55202019-10-15T16:48:05Z2019-10-15T16:48:05Zdefine errors are const, this allows easy comparison tooHiltjo Posthumahiltjo@codemadness.orgcommit 03e5cd467dd7219175dc25fe821cea5e6d2a5520
parent f8704af3ceec42fb7be10caca4392c85f82631eb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 18:48:05 +0200
define errors are const, this allows easy comparison too
f8704af3ceec42fb7be10caca4392c85f82631eb2019-10-15T16:43:56Z2019-10-15T16:43:56Zdifferent scaling for memory allocationHiltjo Posthumahiltjo@codemadness.orgcommit f8704af3ceec42fb7be10caca4392c85f82631eb
parent dfd26e7ccf4f83f4c140503b69d773b1dbb81808
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 18:43:56 +0200
different scaling for memory allocation
greedier for large strings, much less memory for smaller ones
dfd26e7ccf4f83f4c140503b69d773b1dbb818082019-10-14T22:48:48Z2019-10-14T22:48:48Zcheck a capacity before a writeHiltjo Posthumahiltjo@codemadness.orgcommit dfd26e7ccf4f83f4c140503b69d773b1dbb81808
parent c12ff5a298eaa6efaa2651b5ea16dde24dae1147
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 00:48:48 +0200
check a capacity before a write
c12ff5a298eaa6efaa2651b5ea16dde24dae11472019-10-14T22:46:31Z2019-10-14T22:46:31Zcheck capacity before each write, reset name of object keys always on ':'Hiltjo Posthumahiltjo@codemadness.orgcommit c12ff5a298eaa6efaa2651b5ea16dde24dae1147
parent 65cdb7d2d32ee17246328b50c5a0ae4deab585fb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 00:46:31 +0200
check capacity before each write, reset name of object keys always on ':'
65cdb7d2d32ee17246328b50c5a0ae4deab585fb2019-10-14T22:19:24Z2019-10-14T22:19:24Zfix for empty key in objectsHiltjo Posthumahiltjo@codemadness.orgcommit 65cdb7d2d32ee17246328b50c5a0ae4deab585fb
parent 794f0a187d7ed4d72e60fbad7186e17f71ca23c4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 00:19:24 +0200
fix for empty key in objects
reproduce: {"a":1,"":"b"}
794f0a187d7ed4d72e60fbad7186e17f71ca23c42019-10-14T21:08:23Z2019-10-14T21:08:23Zhandle empty strings correctlyHiltjo Posthumahiltjo@codemadness.orgcommit 794f0a187d7ed4d72e60fbad7186e17f71ca23c4
parent 78d6bc291c601ffda102b3572c642bd79f415449
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 14 Oct 2019 23:08:23 +0200
handle empty strings correctly
reproduce: [""]
78d6bc291c601ffda102b3572c642bd79f4154492019-10-14T20:55:03Z2019-10-14T20:55:03Zcheck unclosed arrays/objects more strictlyHiltjo Posthumahiltjo@codemadness.orgcommit 78d6bc291c601ffda102b3572c642bd79f415449
parent d45f1447a26996cfbaf80c5a37a3ba51a48aecb8
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 14 Oct 2019 22:55:03 +0200
check unclosed arrays/objects more strictly
d45f1447a26996cfbaf80c5a37a3ba51a48aecb82019-10-14T20:53:19Z2019-10-14T20:53:19Zcheck closing of object and array in a more logical and strict wayHiltjo Posthumahiltjo@codemadness.orgcommit d45f1447a26996cfbaf80c5a37a3ba51a48aecb8
parent 1232e02c50535bb4f9b363a2dada9525260ed059
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 14 Oct 2019 22:53:19 +0200
check closing of object and array in a more logical and strict way
(should have no functional difference though, since it is unreachable)
1232e02c50535bb4f9b363a2dada9525260ed0592019-10-14T20:51:15Z2019-10-14T20:51:15Zsimplify type printingHiltjo Posthumahiltjo@codemadness.orgcommit 1232e02c50535bb4f9b363a2dada9525260ed059
parent 92f3832c6fb144de7a13d962327128368912907b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 14 Oct 2019 22:51:15 +0200
simplify type printing
92f3832c6fb144de7a13d962327128368912907b2019-10-14T20:49:46Z2019-10-14T20:49:46Zbe much less memory greedyHiltjo Posthumahiltjo@codemadness.orgcommit 92f3832c6fb144de7a13d962327128368912907b
parent 058bab370580f79697a492b58a8547a5deae6e64
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 14 Oct 2019 22:49:46 +0200
be much less memory greedy
058bab370580f79697a492b58a8547a5deae6e642019-10-13T19:40:11Z2019-10-13T19:40:11Zsimplify calculation: the low surrogate range is already checkedHiltjo Posthumahiltjo@codemadness.orgcommit 058bab370580f79697a492b58a8547a5deae6e64
parent 933582372d81a911193fb1da7c86b6b960432535
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 13 Oct 2019 21:40:11 +0200
simplify calculation: the low surrogate range is already checked
933582372d81a911193fb1da7c86b6b9604325352019-10-13T19:31:31Z2019-10-13T19:31:31Zadd support for high-low surrogates and UTF-16 decodingHiltjo Posthumahiltjo@codemadness.orgcommit 933582372d81a911193fb1da7c86b6b960432535
parent 922491e0343ab6f440024803921daf843b0e9cf5
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 13 Oct 2019 21:31:31 +0200
add support for high-low surrogates and UTF-16 decoding
seen in the wild on a Reddit JSON file encoding emojis.
It is also mentioned in the RFC7159 - 7. Strings
922491e0343ab6f440024803921daf843b0e9cf52019-10-13T12:52:39Z2019-10-13T12:52:39Zdocumentation: use the name TAB-Separate Value format (TSV)Hiltjo Posthumahiltjo@codemadness.orgcommit 922491e0343ab6f440024803921daf843b0e9cf5
parent 30c28c0ba7a3bec23f3c964f59aef85a9c2ba615
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 13 Oct 2019 14:52:39 +0200
documentation: use the name TAB-Separate Value format (TSV)
30c28c0ba7a3bec23f3c964f59aef85a9c2ba6152019-10-13T12:51:50Z2019-10-13T12:51:50Zfix integer overflow checkHiltjo Posthumahiltjo@codemadness.orgcommit 30c28c0ba7a3bec23f3c964f59aef85a9c2ba615
parent 79e73bfa51005f9b760c01117f4decce4435fe29
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 13 Oct 2019 14:51:50 +0200
fix integer overflow check
79e73bfa51005f9b760c01117f4decce4435fe292019-10-06T14:31:37Z2019-10-06T14:31:37Zimprove documentation, reference man page in the READMEHiltjo Posthumahiltjo@codemadness.orgcommit 79e73bfa51005f9b760c01117f4decce4435fe29
parent 60cdcd6ec005e72e168f0318228371471121ad9b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 6 Oct 2019 16:31:37 +0200
improve documentation, reference man page in the README
60cdcd6ec005e72e168f0318228371471121ad9b2019-10-06T14:20:13Z2019-10-06T14:20:13Zoptimize and simplify a bit: allow more efficient bufferingHiltjo Posthumahiltjo@codemadness.orgcommit 60cdcd6ec005e72e168f0318228371471121ad9b
parent f831a4b76c10d7efcb72effd18332f3deac7a4fa
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 6 Oct 2019 16:20:13 +0200
optimize and simplify a bit: allow more efficient buffering
on a sample input using getchar_unlocked and putchar_unlocked parsed
113MB of JSON data in 1.7 seconds vs 2.7.
Tested with gcc and clang.