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 | 071a9bcb91ac7fb30b1f3669340532b961f6db4c (patch) | |
tree | 1f6be01f3d338178080bee7a5d16c541af94ab72 /dependencies/uthash/src/utarray.h | |
parent | f9d9849300c5a8777ae9a2213d32a7c0f5799b45 (diff) | |
parent | 9a14454d3c5589373253571cee7428c593adefd9 (diff) |
Merge commit '9a14454d3c5589373253571cee7428c593adefd9'
Diffstat (limited to 'dependencies/uthash/src/utarray.h')
-rw-r--r-- | dependencies/uthash/src/utarray.h | 18 |
1 files changed, 11 insertions, 7 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; |