Paul J. Davis [Thu, 27 Feb 2020 18:01:54 +0000 (12:01 -0600)]
Merge remote-tracking branch 'davisp/master'
Paul J. Davis [Thu, 27 Feb 2020 17:48:51 +0000 (11:48 -0600)]
1.0.4
Paul J. Davis [Thu, 27 Feb 2020 17:45:58 +0000 (11:45 -0600)]
Fix binary leak when encoding large strings
This bug was due to an interaction between two optimizations. If we
attempt to flush the buffer before any bytes are used we refused.
However, in enc_ensure we were not checking whether the buffer was
actually flushed so we would allocate a new buffer for the request.
The easiest way to encounter this issue was by encoding a raw binary
longer than 2041 bytes (i.e., `jiffy:encode(<<"stuff...">>).`).
Paul J. Davis [Thu, 6 Feb 2020 21:59:01 +0000 (15:59 -0600)]
Merge remote-tracking branch 'davisp/master'
Paul J. Davis [Thu, 6 Feb 2020 21:52:59 +0000 (15:52 -0600)]
Version 1.0.3
Joan Touzet [Thu, 6 Feb 2020 20:55:10 +0000 (15:55 -0500)]
Force Windows to export inlined functions
Paul J. Davis [Wed, 5 Feb 2020 15:59:42 +0000 (09:59 -0600)]
Merge remote-tracking branch 'davisp/master'
Paul J. Davis [Tue, 4 Feb 2020 20:53:30 +0000 (14:53 -0600)]
Only use -flto when supported
This adds a dynamic check to see if -flto is supported by the compiler.
Co-Authored-By: JianBo He <heeejianbo@gmail.com>
Paul J. Davis [Tue, 4 Feb 2020 20:42:21 +0000 (14:42 -0600)]
Update Travis-CI Matrix
Apparently Travis-CI has dropped some of the older Erlang versions. I've
also added a run on 22.x
Paul J. Davis [Sun, 5 Jan 2020 20:15:39 +0000 (14:15 -0600)]
Merge remote-tracking branch 'davisp/master'
Paul J. Davis [Mon, 13 May 2019 17:06:45 +0000 (12:06 -0500)]
1.0.1
Paul J. Davis [Mon, 13 May 2019 16:57:57 +0000 (11:57 -0500)]
Use from_array instead of positional versions
Paul J. Davis [Mon, 13 May 2019 16:53:39 +0000 (11:53 -0500)]
Fix backwards compatibility
Paul J. Davis [Mon, 13 May 2019 16:53:22 +0000 (11:53 -0500)]
Remove accidentally commited rebar state
Paul J. Davis [Mon, 13 May 2019 14:45:34 +0000 (09:45 -0500)]
Fix R14 support
Paul J. Davis [Mon, 13 May 2019 14:39:31 +0000 (09:39 -0500)]
Fix support of VMs pre-17.x
Paul J. Davis [Mon, 13 May 2019 14:37:18 +0000 (09:37 -0500)]
Fix support for Erlang 17.x
Paul J. Davis [Mon, 13 May 2019 14:13:54 +0000 (09:13 -0500)]
1.0.0
Paul J. Davis [Mon, 13 May 2019 14:13:13 +0000 (09:13 -0500)]
Update readme with the exception type change
Paul J. Davis [Mon, 13 May 2019 14:11:06 +0000 (09:11 -0500)]
Upgrade to double-converson 3.1.4
Paul J. Davis [Mon, 13 May 2019 13:58:58 +0000 (08:58 -0500)]
Change errors for bignums to be more explicit
Co-Authored-By: Stephan Renatus <srenatus@chef.io>
John Högberg [Thu, 11 Apr 2019 12:53:24 +0000 (14:53 +0200)]
Remove -fno-strict-aliasing
We don't do fishy things like type punning so it really isn't
necessary, and supplying it prevents certain optimizations.
John Högberg [Thu, 11 Apr 2019 11:32:45 +0000 (13:32 +0200)]
Get rid of separate unsigned/signed buffers
John Högberg [Thu, 11 Apr 2019 11:30:05 +0000 (13:30 +0200)]
Never expand the encode buffer; emit and restart
This greatly increases the performance of long string encodes as
we won't need to copy intermediate results over and over.
John Högberg [Thu, 11 Apr 2019 04:39:33 +0000 (06:39 +0200)]
Fix erroneous state check in the decoder
If the input contained a mismatched end-of-array/object, the stack
could become empty before a call to dec_curr, which would look
beyond the bounds of the stack. If the value at this invalid
position happened to be st_array, we would pop too much from the
stack and overwrite the data that came before it.
This commit fixes this by letting dec_pop return the previous
state or st_invalid if the stack is empty, letting us exit
gracefully if the state isn't what we expect it to be.
dec_pop_assert is identical to the old dec_pop, tearing down the
emulator on internal errors.
John Högberg [Mon, 8 Apr 2019 05:45:51 +0000 (07:45 +0200)]
Enable link-time optimization on *nix platforms
John Högberg [Tue, 9 Apr 2019 10:17:13 +0000 (12:17 +0200)]
Move all atom checks under enif_is_atom
John Högberg [Tue, 9 Apr 2019 08:17:05 +0000 (10:17 +0200)]
Use the result map for key dedupe
This is a wee bit more cache-friendly than using a std::set with
string keys.
John Högberg [Tue, 9 Apr 2019 07:17:17 +0000 (09:17 +0200)]
Refactor trapping and trap more often during decode
John Högberg [Tue, 9 Apr 2019 06:08:23 +0000 (08:08 +0200)]
Skip erroneous UTF-8 validation for atoms
We requested atoms in latin1 and then handled them as utf-8,
erroring out on some valid atoms and performing pointless
validation on others.
John Högberg [Tue, 9 Apr 2019 05:56:21 +0000 (07:56 +0200)]
Use enif_is_identical for equality checks
John Högberg [Tue, 9 Apr 2019 05:40:22 +0000 (07:40 +0200)]
Replace sprintf with a dedicated integer print routine
John Högberg [Tue, 9 Apr 2019 05:18:34 +0000 (07:18 +0200)]
Skip redundant enif_is_empty_list checks during encode
enif_get_list_cell fails when the list is empty.
John Högberg [Tue, 9 Apr 2019 05:12:21 +0000 (07:12 +0200)]
Use realloc instead of doing it manually
John Högberg [Mon, 8 Apr 2019 14:04:33 +0000 (16:04 +0200)]
Walk through strings once when encoding
John Högberg [Mon, 8 Apr 2019 10:57:16 +0000 (12:57 +0200)]
Use an array for the position stack rather than an Erlang list
John Högberg [Tue, 9 Apr 2019 10:35:03 +0000 (12:35 +0200)]
sizeof(char) == 1 by definition
Paul J. Davis [Fri, 11 May 2018 17:14:31 +0000 (12:14 -0500)]
0.15.2
Eric Meadows-Jönsson [Sat, 4 Jun 2016 19:59:03 +0000 (21:59 +0200)]
Raise errors instead of throwing
Andreas Krüger [Wed, 14 Mar 2018 11:29:00 +0000 (12:29 +0100)]
Documentation improvement decode option copy_strings.
Jihyun Yu [Wed, 26 Sep 2018 10:18:19 +0000 (19:18 +0900)]
fix bug on hex escape table
number of items on `hexvals` is 128 while table size is 256, so
remaining 128 items are filled with zero. As a result, values in
\xf0-\xff will be treated as zero while should be rejected.
David Hull [Wed, 13 Feb 2019 00:21:30 +0000 (00:21 +0000)]
Fix decoding of "\uDBFF\uDFFF" surrogate pair.
getong [Mon, 25 Jun 2018 12:27:40 +0000 (20:27 +0800)]
add test erlang/otp 21
Martin Wiso [Fri, 11 May 2018 10:15:28 +0000 (12:15 +0200)]
Explicitly list xmerl for relase to include it
Paul J. Davis [Thu, 8 Mar 2018 17:09:08 +0000 (11:09 -0600)]
0.15.1
Sam Tavakoli [Thu, 8 Mar 2018 15:33:24 +0000 (15:33 +0000)]
Add missing option for copy strings
Without this, call to decode with copy_strings option in an
application will make Dialyzer complain when using the exported type for options
Paul J. Davis [Fri, 5 Jan 2018 19:12:20 +0000 (13:12 -0600)]
This is 0.15.0
Lynn Gabbay [Fri, 5 Jan 2018 17:51:24 +0000 (01:51 +0800)]
fixed issue 162 regarding duplicate keys in objects
Paul J. Davis [Wed, 1 Nov 2017 19:18:15 +0000 (14:18 -0500)]
Add `copy_strings` feature
Some users of Jiffy have experienced issues when decoding large JSON
documents. Normally Jiffy expects smallish documents and returns any
strings as sub-binaries. When dealing with large documents these
sub-binary references can keep a large amount of RAM around unless the
user goes through and applies `binary:copy/1` on every string returned
from Jiffy. This however causes a large amount of CPU usage to do
something that Jiffy could do as it builds the JSON structure.
The `copy_strings` decoder option does exactly this. Instead of
returning sub-binaries Jiffy now copies every string into a newly
allocated binary. Users report that this fixes the memory issues while
also not negatively affecting performance significantly.
Paul J. Davis [Wed, 1 Nov 2017 19:31:06 +0000 (14:31 -0500)]
Merge remote-tracking branch 'davisp/master'
Paul J. Davis [Wed, 1 Nov 2017 19:30:09 +0000 (14:30 -0500)]
Bump to 0.14.13
Paul J. Davis [Wed, 1 Nov 2017 19:29:37 +0000 (14:29 -0500)]
Fix type spec
Paul J. Davis [Tue, 31 Oct 2017 17:11:18 +0000 (12:11 -0500)]
Bump to 0.14.12
Paul J. Davis [Tue, 31 Oct 2017 17:10:49 +0000 (12:10 -0500)]
Add tests for deduplication in child objects
Paul J. Davis [Tue, 31 Oct 2017 17:09:56 +0000 (12:09 -0500)]
Document dedupe_keys option
Paul J. Davis [Mon, 30 Oct 2017 21:40:55 +0000 (16:40 -0500)]
Merge remote-tracking branch 'davisp/master'
Paul J. Davis [Mon, 30 Oct 2017 19:01:53 +0000 (14:01 -0500)]
Add `dedupe_keys` option
You can no optionally request that keys are deduplicate inside of Jiffy
instead of having to perform that operation in Erlang.
David Hull [Thu, 5 Oct 2017 20:48:56 +0000 (20:48 +0000)]
Tighten string buffer size calculation in enc_string.
When "\u"-escaping a Unicode character, the esc_extra value doesn't
need to include the number of bytes in the input string. That is, if
a three-byte UTF-8 character is being escaped to a six-byte "\uXXXX"
sequence, esc_extra only needs to be increased by 3.
getong [Tue, 29 Aug 2017 10:01:58 +0000 (18:01 +0800)]
test erlang 20
Paul J. Davis [Thu, 6 Jul 2017 22:35:24 +0000 (17:35 -0500)]
Merge remote-tracking branch 'davisp/master'
Paul J. Davis [Thu, 6 Jul 2017 22:33:44 +0000 (17:33 -0500)]
Merge pull request #151 from wohali/win32-cleanup
Cleanup after new enc lands
Paul J. Davis [Thu, 6 Jul 2017 22:31:13 +0000 (17:31 -0500)]
Merge remote-tracking branch 'davisp/master'
Paul J. Davis [Thu, 6 Jul 2017 22:26:17 +0000 (17:26 -0500)]
Update enc for Windows support
Joan Touzet [Thu, 6 Jul 2017 21:05:55 +0000 (17:05 -0400)]
Cleanup after new enc lands
Paul J. Davis [Wed, 7 Jun 2017 16:00:57 +0000 (11:00 -0500)]
Merge remote-tracking branch 'davisp/master'
Update to latest Jiffy
Paul J. Davis [Wed, 7 Jun 2017 15:54:35 +0000 (10:54 -0500)]
Replace old test case with generated data
For some reason I left a 377KiB test case checked in. Replacing this
with a generated test case is obvious in hindsight.
Paul J. Davis [Fri, 17 Mar 2017 20:34:32 +0000 (15:34 -0500)]
Specify the escript executable for hooks
Windows appears to not enjoy relative path names for exectuables so
hopefully this fixes things there.
Fixes #83
Paul J. Davis [Sat, 31 Dec 2016 02:59:49 +0000 (20:59 -0600)]
Jiffy 0.14.11
Paul J. Davis [Sat, 31 Dec 2016 02:57:25 +0000 (20:57 -0600)]
Maintain my own file list for hex
Apparently hex only includes some files by default but not others
rather than a sane default of anything except for VCS directories. So
now I also get to maintain a list of files in my .app.src.
Paul J. Davis [Thu, 29 Dec 2016 18:46:54 +0000 (12:46 -0600)]
Bump to 0.14.10 because rebar3 is inept
Apparently rebar3 can't generate a sane version number from Git tags and
adds a bunch of BS build number and ref tags which hex.pm then rejects.
Given that I can't find any documentation on how that works and reading
code is an exercise in over engineered abstractionism I've succumbed to
the demoralizing conclusion that I'll just have to go back to the dark
ages and maintain my versions both in source and in version control.
Dan Swain [Thu, 19 May 2016 22:44:53 +0000 (18:44 -0400)]
Add `use_nil` to `encode_option`
A call to `jiffy:encode(Term, [use_nil]).` will currently cause dialyzer
to issue a warning because `use_nil` is not included in `encode_option`.
This appears to just be an omission.
Paul J. Davis [Mon, 10 Oct 2016 16:53:57 +0000 (11:53 -0500)]
Merge pull request #118 from davisp/feature-add-rebar3-support
Add support for rebar3
Paul J. Davis [Fri, 18 Mar 2016 20:48:20 +0000 (15:48 -0500)]
Add support for rebar3
Allow Jiffy to be used easily in projects using either rebar 2 or 3.
Paul J. Davis [Fri, 23 Sep 2016 20:35:20 +0000 (15:35 -0500)]
Update the list of Erlang VMs to use on Travis-CI
Paul J. Davis [Fri, 23 Sep 2016 20:19:19 +0000 (15:19 -0500)]
Replace PropEr with EQC
PropEr broke my support for R14. Turns out that EQC Mini is quite usable
so I've just switched to that. If EQC Mini exists it will be used, if
not the test is skipped gracefully.
Paul J. Davis [Thu, 14 Jul 2016 20:41:24 +0000 (15:41 -0500)]
Merge branch 'upstream'
Paul J. Davis [Wed, 13 Jul 2016 19:46:22 +0000 (14:46 -0500)]
Fix enc_long for 64-bit Windows
Originally reported by @NorthNick on apache/couchdb-jiffy.
Paul J. Davis [Wed, 6 Apr 2016 15:08:49 +0000 (10:08 -0500)]
Merge pull request #119 from egobrain/patch-1
Fixed wrong jiffy:decode/2 spec
Yakov [Wed, 6 Apr 2016 10:22:01 +0000 (14:22 +0400)]
Fixed wrong jiffy:decode/2 spec
Paul J. Davis [Thu, 31 Mar 2016 16:00:10 +0000 (11:00 -0500)]
Fix force_utf8 for object keys
Previously if a key was malformed UTF-8 and the user specified the
`force_utf8` option we would fail to try and encode a fixed up version
of the object. This was due to missing a clause to catch the
`invalid_object_member_key` exception. This adds the clause and a couple
tests to ensure it works.
Paul J. Davis [Wed, 6 Jan 2016 19:28:05 +0000 (13:28 -0600)]
Copy double-conversion license to root LICENSE
This was marked in the c_src/double-conversion directory but I've gone
ahead and added a copy to the root LICENSE file.
Paul J. Davis [Wed, 6 Jan 2016 19:07:47 +0000 (13:07 -0600)]
Ignore hexer.config
Paul J. Davis [Wed, 6 Jan 2016 19:03:05 +0000 (13:03 -0600)]
Update jiff.app.src for hex.pm
Time for Jiffy to enter the world of Erlang package management.
Paul J. Davis [Wed, 6 Jan 2016 18:59:08 +0000 (12:59 -0600)]
Remove ETAP license information
Paul J. Davis [Wed, 2 Dec 2015 17:29:36 +0000 (11:29 -0600)]
Document the use_nil option for encoding JSON
Paul J. Davis [Wed, 2 Dec 2015 17:23:30 +0000 (11:23 -0600)]
Remove old debug printing
Paul J. Davis [Wed, 2 Dec 2015 17:21:32 +0000 (11:21 -0600)]
Merge pull request #113 from jparise/map-iter-destroy
Destroy map iterators once we're done with them.
Jon Parise [Wed, 25 Nov 2015 22:58:00 +0000 (17:58 -0500)]
Destroy map iterators once we're done with them.
Each call to enif_map_iterator_create() must be paired with a call to
enif_map_iterator_destroy(). Otherwise, we'll leak memory.
Fixes #112
Adam Krupicka [Tue, 13 Oct 2015 12:54:39 +0000 (14:54 +0200)]
Fix jiffy:encode Dialyzer spec.
Paul J. Davis [Mon, 31 Aug 2015 16:51:10 +0000 (11:51 -0500)]
Merge pull request #104 from pinotree/hurd
rebar.config: set CFLAGS/CXXFLAGS/LDFLAGS on Hurd
Paul J. Davis [Mon, 31 Aug 2015 16:31:28 +0000 (11:31 -0500)]
Don't rely on an environment variable for Travis
The environment variable approach breaks other projects' Travis-CI runs
if they include other projects that depend on a different version of
PropEr.
Fixes: #106
Joan Touzet [Thu, 27 Aug 2015 18:25:54 +0000 (14:25 -0400)]
Reduce C++ flags to -O2 to fix gcc5 build
Joan Touzet [Thu, 27 Aug 2015 17:53:43 +0000 (13:53 -0400)]
fix Windows compile options
Pino Toscano [Mon, 24 Aug 2015 21:08:13 +0000 (23:08 +0200)]
rebar.config: set CFLAGS/CXXFLAGS/LDFLAGS on Hurd
Use the common CFLAGS/CXXFLAGS/LDFLAGS used on Linux/FreeBSD/etc also
on GNU/Hurd.
Paul J. Davis [Fri, 21 Aug 2015 20:04:35 +0000 (15:04 -0500)]
Merge pull request #103 from vicglarson/master
Fix win32 build
Victor Galkin [Thu, 20 Aug 2015 11:59:58 +0000 (14:59 +0300)]
Fix win32 build
Alexander Shorin [Tue, 28 Jul 2015 22:41:56 +0000 (01:41 +0300)]
Merge branch 'upstream-merge'
Paul J. Davis [Sat, 25 Jul 2015 17:47:52 +0000 (12:47 -0500)]
Fix compiler warning on gcc 5.1.0
Alexander Shorin [Sat, 25 Jul 2015 12:51:07 +0000 (15:51 +0300)]
Remove travis notification
Alexander Shorin [Sat, 25 Jul 2015 12:50:47 +0000 (15:50 +0300)]
Remove related path to rebar