Commit Graph
53 Commits
Author SHA1 Message Date
pancake bf29079711 Fix minunit 2025-11-17 20:21:20 +01:00
pancake 5ccf37667f Fix warning in minunit 2025-11-17 19:53:55 +01:00
pancake 1a57c418b3 Add strbuf api and use it for cgen 2025-06-13 13:13:39 +02:00
pancake e4b166e8c3 Use sdb/sdb.h to solve include conflicts and simplify build 2022-11-18 11:19:31 +01:00
pancake ec2e34a1dc Cache miss optimizations and dont preincrement in fors 2022-07-02 21:33:50 +02:00
pancake ef69b8bcf7 Fix testsuite 2022-05-17 11:42:02 +02:00
pancake aa6d13a2a3 Remove all calls to eprintf from library apis (#248)
* fputs(stdout) is still pending to be removed, but this requires breaking API and ABI
2022-02-25 19:04:19 +01:00
pancake d76a88c0cf Use stdint types (#247) 2022-02-25 16:45:45 +01:00
pancake b6965582e9 Make sdb compilable as C++ (#245)
* Make sdb compilable as C++

* Add casts as void* is not typable enough
* Add ls_foreach_cast
* ht_inc.h is now named ht.inc
* Add 'make x' or 'make o' to compile in c++ or in a single shot
* Remove macros from text.c
* Avoid using extern when its not extern
* Add missing license headers
* Add extern "C" in all the include files
* Test C++ builds in the CI
2022-02-23 20:54:25 +01:00
meme e7d259c23a Remove TLS and make sdb thread-safe
* Nuke sdb_fmt
* Mark goto tables as const
* Mark lookup table as const
* Move nextcas into SdbKv
* Remove global hook (cannot be used without TLS, but we want to avoid
  that)
* Fix lock path to not use a static buffer
2022-01-18 09:56:32 +01:00
pancake b0c7e061ac Fix asan leaks in tests 2022-01-17 16:16:59 +01:00
pancake 79d1fa3ffa Optimize ls_sort() fixes https://github.com/radareorg/radare2/issues/18322 2021-05-19 22:44:35 +02:00
pancake 054f49845b Use sdb_fmt in a proper way 2020-12-27 11:27:49 +01:00
Florian Märkl 14577b7e3e Fix OOB write in text parsing (#226) 2020-10-31 15:52:02 +01:00
Florian Märkl ee24c44312 Add plaintext SDB format (#219) 2020-10-12 18:41:37 +02:00
Florian Märkl 3d81b4663f Add Unit Tests to Meson and fix some Warnings (#217) 2020-09-28 14:57:27 +02:00
Anisse Astier a8a98e96f2 Bring merge sort and insertion sort cmp function semantics together (#212)
Merge sort uses cmp (a, b) < 0 for its first test branch, and insertion
sort cmp (a, b) > 0 ; which means the 0 boundary goes in one case in one
branch, and in the other sort function in the other branch.

We keep the semantics of the insertion sort, it makes it possible to
support compare function that return true/false instead of a distance
between items.

Add a test that was previously failing for merge sort, but working with
insertion sort, although the function is not exposed, it only triggers
at > 43 elements.

The main difference is the test function that sends true/false instead
of a difference between two integers.
2020-08-18 11:56:58 +02:00
Florian Märkl c3bbac8608 Add sdb_copy() API (#200) 2019-10-25 15:28:12 +02:00
Florian Märkl 30a8723229 Add better diffing in (sdb -D) (#198) 2019-10-23 11:18:47 +02:00
Riccardo Schirone 9d9e203ae2 Remove test_grow_5 test case because too slow (#188) 2019-02-18 11:23:40 +01:00
Riccardo Schirone fc31557f44 Fix edge case in HT when growing past last precomputed prime number 2019-02-15 21:51:15 +01:00
Riccardo Schirone 5bd279a9f5 Add Ht update_key API 2019-01-15 19:56:31 +01:00
Domen Puncer Kugler c9af602997 Fix memory leaks in test/unit 2018-11-28 09:42:03 +01:00
Riccardo Schirone ea05ca8808 Use "generics" to create multiple types of Ht 2018-11-12 11:44:45 +01:00
Riccardo Schirone 132bb12e61 ht: provide ht_new_opt API to customize the hashtable (#175) 2018-11-08 16:21:09 +01:00
Riccardo Schirone 3debbd57eb ht: provide ht_new0 API for convenience (#174) 2018-11-08 12:46:15 +01:00
Riccardo Schirone 5d42591982 Optimizations and cleanup in the hashtable (4x speedup) 2018-10-26 13:14:21 +02:00
Riccardo Schirone f0f166882c sdb: add API to return (sorted) list filtered (#166) 2018-10-11 01:23:51 +02:00
Riccardo Schirone 0f7249864c SdbHt: reintroduce growing (#160)
* Fixes for pkgconfig and meson
* Install missing headers
* Make tests runnable even if sdb is not installed
* refactor CFLAGS/LDFLAGS/SDB env var settings
* ht: remove load_factor field and introduce ht_new_size API
* handle more than the max number of precomputed prime indexes
* use HtKv inside SdbHtKv instead of copying its fields
* query: fix compiler warning by adding (char *)
* sdbht: create BUCKET macro
* ht: do not use macros, prefer static functions
2018-10-08 21:19:19 +02:00
Riccardo Schirone 16804938be SdbKv refactor (#162) 2018-10-05 10:35:17 +02:00
Riccardo Schirone 109c102f54 Create pkg-config file in meson and make tests runnable from meson (#158)
* install missing headers
* make tests runnable even if sdb is not installed
* refactor CFLAGS/LDFLAGS/SDB env var settings
* sdb-test.mk: do not use -static because it doesn't work on OS X
* test: use sdb-test.sh in suite/run.sh too
* sdb-test.sh: fix current path detection
2018-10-04 11:59:32 +02:00
pancake de85bc34d3 Rename SdbHash into SdbHt 2018-09-16 00:32:30 +02:00
alvarofe 721d40b722 Lower to 500000 elements to sort 2017-03-26 23:04:17 +02:00
alvarofe b545d91598 Improve ls sort and added more unit test 2017-03-26 22:59:57 +02:00
Gauvain Roussel-Tarbouriech 156e5f8cfd Sdb unit test for sorting big lists 2017-03-26 19:33:32 +02:00
alvarofe a0ae5997a0 Fix mem leak in test_hash 2017-02-28 20:40:18 +01:00
Álvaro Felipe Melchor df4a0c2371 simplify api in ht
as long as the key by now will be a string we can have defaults
2017-02-02 23:56:13 +01:00
Álvaro Felipe Melchor a4b4cbfbe6 added test for general ht 2017-01-05 23:55:25 +01:00
Álvaro Felipe Melchor a7eb15a627 Make some change in hashtable implementation
ht.c and ht.h old a general implementation, on the other hand sdbht.c
and sdbht.h use ht.c and ht.h with value as a char*.

The idea will be to use this hashtable implementation within r2
2017-01-05 02:19:09 +01:00
pancake f282e22cc3 Run the no-mman thru the suite 2017-01-04 17:45:03 +01:00
pancake 3fa0134c19 Fix two more regressions (8 left) 2016-10-31 18:11:57 +01:00
Riccardo Schirone 78f5ee429e Add some docs + unit tests (#115) 2016-10-31 17:03:24 +01:00
pancake 5df680edd7 Add sorted parameter to sdb_foreach_list() 2016-10-31 11:41:30 +01:00
pancake 6377ac562a Remove ns test 2016-10-26 00:43:08 +02:00
pancake 25c3eb2a2d Fix two bugs in ns.sync() and sdb.free() and add namespace test 2016-10-26 00:28:11 +02:00
pancake 131ce35660 Move some tests to unit 2016-10-25 23:21:33 +02:00
pancake b71e11fcd7 Fix off-by-one issue in sdb_array_insert 2016-10-25 01:53:47 +02:00
pancake 8009b8c69b Add test_array 2016-10-25 01:25:29 +02:00
pancake cb34ea0c19 Add two more sdb_delete tests 2016-10-24 22:46:17 +02:00
pancake dd5509130f Add unit/test_sdb 2016-10-24 22:02:25 +02:00