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 [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: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 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: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: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 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 [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
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
Paul J. Davis [Sat, 25 Jul 2015 17:47:52 +0000 (12:47 -0500)]
Fix compiler warning on gcc 5.1.0
Paul J. Davis [Fri, 17 Jul 2015 17:31:11 +0000 (12:31 -0500)]
Add latest Erlang VMs to the test matrix
Paul J. Davis [Fri, 17 Jul 2015 17:18:21 +0000 (12:18 -0500)]
Remove flaky test case
This test has proved its point and now just exists to randomly fail some
builds depending on race conditions with the garbage collector.
Paul J. Davis [Fri, 17 Jul 2015 17:16:48 +0000 (12:16 -0500)]
Fix map type spec
I was being lazy and relying on Travis. This fixes up the map spec for
newer VMs.
Paul J. Davis [Fri, 17 Jul 2015 16:59:50 +0000 (11:59 -0500)]
Add map typespec for dialyzer
This obviously only exists on VMs that support it.
Paul J. Davis [Fri, 17 Jul 2015 16:59:39 +0000 (11:59 -0500)]
Strings can be atoms or binaries
Paul J. Davis [Wed, 15 Jul 2015 23:43:06 +0000 (18:43 -0500)]
Fix dialyzer type specs
Paul J. Davis [Wed, 15 Jul 2015 22:00:42 +0000 (17:00 -0500)]
Revamp yields back to Erlang
In the original PR for `return_trailer` @vlm pointed out that I wasn't
using enif_consume_timeslice correctly. This fixes that by changing out
its called.
Previously we attempted to define the total number of bytes to decode or
encode in a single NIF call and then would consume as much of the
timeslice as we processed. This is wrong because we may start the NIF
call with less than an entire timeslice left.
The new approach is to define the number of bytes to encode or decode
per reduction and then iteratively call enif_consume_timeslice until it
indicates that we should return.
Paul J. Davis [Wed, 15 Jul 2015 21:18:13 +0000 (16:18 -0500)]
Add new return_trailer option
Previously Jiffy would throw an error about trailing data if there is
any non-whitespace character encounter after the first term had been
decoded.
This patch adds a decoder option `return_trailer` that will instead
return a sub-binary starting at the first non-whitespace character. This
allows users to be able to decode multiple terms from a single iodata()
term.
Thanks to @vlm for the original patch.
Paul J. Davis [Wed, 15 Jul 2015 22:53:57 +0000 (17:53 -0500)]
Ignore test XML files
Paul J. Davis [Wed, 15 Jul 2015 20:49:37 +0000 (15:49 -0500)]
Merge pull request #65 from lpgauth/no_native
Add compile option no_native
Paul J. Davis [Wed, 15 Jul 2015 20:45:23 +0000 (15:45 -0500)]
Add Dialyzer types and specs
Thanks to @joedevivo for the contribution.
Fixes #85
Paul J. Davis [Wed, 15 Jul 2015 20:44:18 +0000 (15:44 -0500)]
Squash to new double-conversion
Paul J. Davis [Wed, 15 Jul 2015 20:35:51 +0000 (15:35 -0500)]
Document new encoding and decoding options
Paul J. Davis [Wed, 15 Jul 2015 20:27:04 +0000 (15:27 -0500)]
Update double-conversion to latest master
Paul J. Davis [Wed, 15 Jul 2015 20:19:29 +0000 (15:19 -0500)]
Fix typo in README.md
Thanks to @dvliman and @kxepal for noticing.
Paul J. Davis [Wed, 15 Jul 2015 20:18:30 +0000 (15:18 -0500)]
Merge pull request #93 from ratelle/master
Add replace_undefined and escape_forward_slashes
Jeremie Lasalle Ratelle [Wed, 20 May 2015 22:20:17 +0000 (18:20 -0400)]
Add an option to escape forward slashes
This brings back escaping forward slashes as an option during encoding.
Default is still not to escape.
Jeremie Lasalle Ratelle [Fri, 24 Apr 2015 16:35:32 +0000 (12:35 -0400)]
Add an option to control null value decoding atom
This is pretty much a generalisation of the use_nil option to support an
arbitrary atom.
Paul J. Davis [Fri, 29 May 2015 19:35:26 +0000 (14:35 -0500)]
Merge pull request #92 from emfa/master
Changed pos to unsigned int to prevent warning from happening.