1. Jul 10, 2023
  2. Dec 13, 2022
    • Arthur O'Dwyer's avatar
      HASH_DEL should be able to delete a const-qualified node · ca98384c
      Arthur O'Dwyer authored
      HASH_DEL doesn't need to modify the target node; in fact it should not,
      because that target node is usually going straight back to `free` and
      any modifications to it would be wasted effort. So, let's make that an
      actual tested guarantee, and let's make it const-correct.
      
      Inspired by the discussion in #253.
      ca98384c
  3. Nov 29, 2022
  4. Nov 08, 2022
  5. Oct 03, 2022
  6. Sep 26, 2022
  7. Jun 21, 2022
  8. Jan 30, 2022
  9. Jun 05, 2021
  10. Jun 04, 2021
  11. May 27, 2021
  12. Mar 02, 2021
  13. Feb 25, 2021
  14. Feb 23, 2021
  15. Jan 06, 2021
  16. Jan 02, 2021
    • Arthur O'Dwyer's avatar
      Rename uthash_memcmp to HASH_KEYCMP, step 3. · 388134a0
      Arthur O'Dwyer authored
      This completes the removal of uthash_memcmp,
      and the "feature parity" of HASH_KEYCMP with HASH_FUNCTION.
      
      The mental model, again, is: We default to hashing bytes with HASH_JEN,
      and we default to comparing bytes with `memcmp` out of <string.h>.
      But the user-programmer can override either or both of these defaults
      by compiling with `-DHASH_FUNCTION=...` and/or `-DHASH_KEYCMP=...`.
      388134a0
    • Arthur O'Dwyer's avatar
      Eliminate HASH_FCN; change the handling of HASH_FUNCTION to match HASH_KEYCMP. · 053bed12
      Arthur O'Dwyer authored
      The behavior of these two "supported" codepaths has not changed at all:
      
          #define HASH_FUNCTION foo
          #include <uthash.h>
          HASH_VALUE(...)  // expanded to foo(...)
      
          #include <uthash.h>
          HASH_VALUE(...)  // expanded to HASH_JEN(...)
      
      However, some pathological codepaths have changed.
      The old behavior was that if you had defined `HASH_FUNCTION` before
      including "uthash.h", then when you called `HASH_VALUE` it would expand
      to `HASH_FCN` which would expand to `HASH_FUNCTION`. But if you hadn't
      defined `HASH_FUNCTION` before including "uthash.h", then when you
      called `HASH_VALUE` it would expand to `HASH_FCN` which would expand
      to `HASH_JEN`.
      
          #define HASH_FUNCTION foo
          #include <uthash.h>
          #undef HASH_FUNCTION
          #define HASH_FUNCTION bar
          HASH_VALUE(...)  // expanded to bar(...)
      
          #include <uthash.h>
          #undef HASH_FUNCTION  // unneeded, HASH_FUNCTION is undefined
          #define HASH_FUNCTION bar
          HASH_VALUE(...)  // expanded to HASH_JEN(...)
      
      The new behavior is that `HASH_VALUE` expands to `HASH_FUNCTION`;
      and separately, if you don't define `HASH_FUNCTION` before including
      "uthash.h", we'll default it to `HASH_JEN`.
      
          #define HASH_FUNCTION foo
          #include <uthash.h>
          #undef HASH_FUNCTION
          #define HASH_FUNCTION bar
          HASH_VALUE(...)  // expanded to bar(...)
      
          #include <uthash.h>
          #undef HASH_FUNCTION  // needed, HASH_FUNCTION is defined to HASH_JEN
          #define HASH_FUNCTION bar
          HASH_VALUE(...)  // expanded to bar(...)
      
      This is the way `HASH_KEYCMP` (formerly known as `uthash_memcmp`) has
      always worked. Since these two customization points are used in similar
      ways, it'll be nice to have their codepaths work alike instead of
      subtly different. Also, this gets rid of one level of macro indirection
      (`HASH_FCN` no longer exists), hooray!
      053bed12
    • Arthur O'Dwyer's avatar
      f0e1bd9b
    • Arthur O'Dwyer's avatar
  17. Dec 18, 2020
  18. Dec 09, 2020
    • Arthur O'Dwyer's avatar
      uthash.h: Swap multiplicands to put the widest ones first. · 973bd672
      Arthur O'Dwyer authored
      It was reported in #195 that Visual Studio 2019, on a 32-bit platform,
      produces this warning:
      
          Warning C26451
          Arithmetic overflow: Using operator '*' on a 4 byte value
          and then casting the result to a 8 byte value. Cast the
          value to the wider type before calling operator '*' to
          avoid overflow (io.2).
      
      I'm not 100% sure that this tweak will silence the warning,
      but I think it might, and at least it's harmless.
      
      Fixes #195.
      973bd672
    • Arthur O'Dwyer's avatar
      Always include <stdint.h>, unless HASH_NO_STDINT is defined by the user. · 15ad0427
      Arthur O'Dwyer authored
      See 762026ce and b1d8ab07 for previous attempts (circa 2014-2015)
      to detect whether it's OK to use <stdint.h>; and see #211 for
      how that logic is still incomplete.
      
      Rather than continue down this path, how about we just say that
      your system should either be C99 (it's the year 2020!), or you
      should provide your own "polyfill" version of <stdint.h> in the
      normal search path, or you should `-DHASH_NO_STDINT` and figure
      out the details yourself (e.g. by providing the necessary typedefs
      above where you `#include <uthash.h>`).
      
      Also support `-DHASH_DEFINE_OWN_STDINT` for this next release,
      so that there's an easy backward-compatibility mode. I plan to
      rip out that mode in the release after next, though.
      15ad0427
  19. Dec 04, 2020
    • Arthur O'Dwyer's avatar
      Rename uthash_memcmp to HASH_KEYCMP, step 2. · 6b4768b9
      Arthur O'Dwyer authored
      Well, this certainly fell by the wayside! Back in December 2018
      (two years ago), I did the first part (introducing `HASH_KEYCMP`),
      cut release version 2.1.0, and said we should immediately fix up
      the tests and then let it bake for "a few months" before removing
      all support for `alt_memcmp`. It turns out that I forgot to do
      any of that. So now I've fixed up the tests, just in time to
      cut release version 2.2.0.
      
      Then we can let version 2.2.0 bake for "a few months" (read: maybe
      a couple of years :)) before finally removing `alt_memcmp`.
      
      test96.c now demonstrates the intended usage of HASH_FUNCTION
      and HASH_KEYCMP as a matching pair. (This is similar to the
      pair of template parameters `Hasher, KeyEqual` taken by C++'s
      `unordered_set`; the difference is that we take `KeyNotEqual`,
      so that you can pass in a strcmp-like trivalued comparator --
      but you don't have to, and test96.c regression-tests
      that passing in a plain old not-equal function works fine.
      
      Fixes #157.
      6b4768b9
  20. Dec 03, 2020
  21. Dec 02, 2020
  22. May 13, 2020
  23. May 01, 2020
  24. Apr 29, 2020