diff options
Diffstat (limited to 'dependencies/uthash/src')
-rw-r--r-- | dependencies/uthash/src/utarray.h | 18 | ||||
-rw-r--r-- | dependencies/uthash/src/uthash.h | 16 | ||||
-rw-r--r-- | dependencies/uthash/src/utlist.h | 7 | ||||
-rw-r--r-- | dependencies/uthash/src/utringbuffer.h | 2 | ||||
-rw-r--r-- | dependencies/uthash/src/utstack.h | 2 | ||||
-rw-r--r-- | dependencies/uthash/src/utstring.h | 2 |
6 files changed, 29 insertions, 18 deletions
diff --git a/dependencies/uthash/src/utarray.h b/dependencies/uthash/src/utarray.h index 3a5106666..1fe8bc1c7 100644 --- a/dependencies/uthash/src/utarray.h +++ b/dependencies/uthash/src/utarray.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2021, Troy D. Hanson http://troydhanson.github.io/uthash/ +Copyright (c) 2008-2022, Troy D. Hanson https://troydhanson.github.io/uthash/ All rights reserved. Redistribution and use in source and binary forms, with or without @@ -38,11 +38,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define UTARRAY_UNUSED #endif -#ifdef oom -#error "The name of macro 'oom' has been changed to 'utarray_oom'. Please update your code." -#define utarray_oom() oom() -#endif - #ifndef utarray_oom #define utarray_oom() exit(-1) #endif @@ -234,7 +229,16 @@ typedef struct { static void utarray_str_cpy(void *dst, const void *src) { char *const *srcc = (char *const *)src; char **dstc = (char**)dst; - *dstc = (*srcc == NULL) ? NULL : strdup(*srcc); + if (*srcc == NULL) { + *dstc = NULL; + } else { + *dstc = (char*)malloc(strlen(*srcc) + 1); + if (*dstc == NULL) { + utarray_oom(); + } else { + strcpy(*dstc, *srcc); + } + } } static void utarray_str_dtor(void *elt) { char **eltc = (char**)elt; diff --git a/dependencies/uthash/src/uthash.h b/dependencies/uthash/src/uthash.h index 9a396b617..57c9eac9e 100644 --- a/dependencies/uthash/src/uthash.h +++ b/dependencies/uthash/src/uthash.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2021, Troy D. Hanson http://troydhanson.github.io/uthash/ +Copyright (c) 2003-2022, Troy D. Hanson https://troydhanson.github.io/uthash/ All rights reserved. Redistribution and use in source and binary forms, with or without @@ -51,6 +51,8 @@ typedef unsigned char uint8_t; #else /* VS2008 or older (or VS2010 in C mode) */ #define NO_DECLTYPE #endif +#elif defined(__MCST__) /* Elbrus C Compiler */ +#define DECLTYPE(x) (__typeof(x)) #elif defined(__BORLANDC__) || defined(__ICCARM__) || defined(__LCC__) || defined(__WATCOMC__) #define NO_DECLTYPE #else /* GNU, Sun and other compilers */ @@ -157,7 +159,7 @@ do { if (head) { \ unsigned _hf_bkt; \ HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \ - if (HASH_BLOOM_TEST((head)->hh.tbl, hashval) != 0) { \ + if (HASH_BLOOM_TEST((head)->hh.tbl, hashval)) { \ HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], keyptr, keylen, hashval, out); \ } \ } \ @@ -194,7 +196,7 @@ do { } while (0) #define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8U] |= (1U << ((idx)%8U))) -#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8U] & (1U << ((idx)%8U))) +#define HASH_BLOOM_BITTEST(bv,idx) ((bv[(idx)/8U] & (1U << ((idx)%8U))) != 0) #define HASH_BLOOM_ADD(tbl,hashv) \ HASH_BLOOM_BITSET((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) @@ -206,7 +208,7 @@ do { #define HASH_BLOOM_MAKE(tbl,oomed) #define HASH_BLOOM_FREE(tbl) #define HASH_BLOOM_ADD(tbl,hashv) -#define HASH_BLOOM_TEST(tbl,hashv) (1) +#define HASH_BLOOM_TEST(tbl,hashv) 1 #define HASH_BLOOM_BYTELEN 0U #endif @@ -450,7 +452,7 @@ do { #define HASH_DELETE_HH(hh,head,delptrhh) \ do { \ - struct UT_hash_handle *_hd_hh_del = (delptrhh); \ + const struct UT_hash_handle *_hd_hh_del = (delptrhh); \ if ((_hd_hh_del->prev == NULL) && (_hd_hh_del->next == NULL)) { \ HASH_BLOOM_FREE((head)->hh.tbl); \ uthash_free((head)->hh.tbl->buckets, \ @@ -593,7 +595,9 @@ do { /* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at - * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ + * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx + * (archive link: https://archive.is/Ivcan ) + */ #define HASH_SAX(key,keylen,hashv) \ do { \ unsigned _sx_i; \ diff --git a/dependencies/uthash/src/utlist.h b/dependencies/uthash/src/utlist.h index 1979448a7..08fc59ae6 100644 --- a/dependencies/uthash/src/utlist.h +++ b/dependencies/uthash/src/utlist.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2007-2021, Troy D. Hanson http://troydhanson.github.io/uthash/ +Copyright (c) 2007-2022, Troy D. Hanson https://troydhanson.github.io/uthash/ All rights reserved. Redistribution and use in source and binary forms, with or without @@ -70,6 +70,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #else /* VS2008 or older (or VS2010 in C mode) */ #define NO_DECLTYPE #endif +#elif defined(__MCST__) /* Elbrus C Compiler */ +#define LDECLTYPE(x) __typeof(x) #elif defined(__BORLANDC__) || defined(__ICCARM__) || defined(__LCC__) || defined(__WATCOMC__) #define NO_DECLTYPE #else /* GNU, Sun and other compilers */ @@ -709,7 +711,8 @@ do { assert((del)->prev != NULL); \ if ((del)->prev == (del)) { \ (head)=NULL; \ - } else if ((del)==(head)) { \ + } else if ((del) == (head)) { \ + assert((del)->next != NULL); \ (del)->next->prev = (del)->prev; \ (head) = (del)->next; \ } else { \ diff --git a/dependencies/uthash/src/utringbuffer.h b/dependencies/uthash/src/utringbuffer.h index c2b2e673c..603411798 100644 --- a/dependencies/uthash/src/utringbuffer.h +++ b/dependencies/uthash/src/utringbuffer.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2015-2021, Troy D. Hanson http://troydhanson.github.io/uthash/ +Copyright (c) 2015-2022, Troy D. Hanson https://troydhanson.github.io/uthash/ All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/dependencies/uthash/src/utstack.h b/dependencies/uthash/src/utstack.h index fc390de10..94b8c5133 100644 --- a/dependencies/uthash/src/utstack.h +++ b/dependencies/uthash/src/utstack.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2018-2021, Troy D. Hanson http://troydhanson.github.io/uthash/ +Copyright (c) 2018-2022, Troy D. Hanson https://troydhanson.github.io/uthash/ All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/dependencies/uthash/src/utstring.h b/dependencies/uthash/src/utstring.h index f6a33af3e..f0270fb63 100644 --- a/dependencies/uthash/src/utstring.h +++ b/dependencies/uthash/src/utstring.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2021, Troy D. Hanson http://troydhanson.github.io/uthash/ +Copyright (c) 2008-2022, Troy D. Hanson https://troydhanson.github.io/uthash/ All rights reserved. Redistribution and use in source and binary forms, with or without |