diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2024-10-17 12:16:20 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2024-10-17 12:16:20 +0200 |
commit | 9a14454d3c5589373253571cee7428c593adefd9 (patch) | |
tree | 2ebd3c81ca4594ed2c9b1267a7af31d8cd1646e9 /src/utarray.h | |
parent | 1fa53c5bf8d0717f784c79abaa5111f88ab00221 (diff) |
Squashed 'dependencies/uthash/' changes from bf152630..f69112c0
f69112c0 utarray: Fix typo in docs
619fe95c Fix MSVC warning C4127 in HASH_BLOOM_TEST (#261)
eeba1961 uthash: Improve the docs for HASH_ADD_INORDER
ca98384c HASH_DEL should be able to delete a const-qualified node
095425f7 utlist: Add one more assertion in DL_DELETE2
399bf74b utarray: Stop making `oom` a synonym for `utarray_oom`
85bf75ab utarray_str_cpy: Remove strdup; utarray_oom() if strdup fails.
1a53f304 GitHub CI: Also test building the docs (#248)
4d01591e The MCST Elbrus C Compiler supports __typeof. (#247)
1e0baf06 CI: Add GitHub Actions CI
8844b529 Update test57.c per a suggestion by @mark-summerfield
44a66fe8 Update http:// URLs to https://, and copyright dates to 2022. NFC.
git-subtree-dir: dependencies/uthash
git-subtree-split: f69112c04f1b6e059b8071cb391a1fcc83791a00
Diffstat (limited to 'src/utarray.h')
-rw-r--r-- | src/utarray.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/utarray.h b/src/utarray.h index 3a5106666..1fe8bc1c7 100644 --- a/src/utarray.h +++ b/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; |