diff options
| author | Cy Schubert <cy@FreeBSD.org> | 2023-06-26 22:56:52 +0000 |
|---|---|---|
| committer | Cy Schubert <cy@FreeBSD.org> | 2023-06-26 22:56:52 +0000 |
| commit | b6a943f7197af1a5eb6bb028b9b808ec5016e30c (patch) | |
| tree | cfbb91e940dd89d0e1d46095f43c228d7d079fa0 /lib/base/string.c | |
| parent | 6f4e10db3298f6d65e1e646fe52aaafc3682b788 (diff) | |
heimdal: Vendor import f62e2f278vendor/heimdal/7.8.0-2023-06-10-f62e2f278vendor/heimdal
Heimdal 7.8.0 does not support OpenSSL 3.0. 7.9.0 will but it hasn't
been released yet. We are importing f62e2f278 for its OpenSSL 3.0
support.
Diffstat (limited to 'lib/base/string.c')
| -rw-r--r-- | lib/base/string.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/base/string.c b/lib/base/string.c index 35ea2182ba3e..5e79e00b18cb 100644 --- a/lib/base/string.c +++ b/lib/base/string.c @@ -36,7 +36,7 @@ #include "baselocl.h" #include <string.h> -static void +static void HEIM_CALLCONV string_dealloc(void *ptr) { heim_string_t s = ptr; @@ -73,11 +73,11 @@ string_cmp(void *a, void *b) return strcmp(a, b); } -static unsigned long +static uintptr_t string_hash(void *ptr) { const char *s = ptr; - unsigned long n; + uintptr_t n; for (n = 0; *s; ++s) n += *s; @@ -153,7 +153,8 @@ heim_string_create_with_bytes(const void *data, size_t len) s = _heim_alloc_object(&_heim_string_object, len + 1); if (s) { - memcpy(s, data, len); + if (len) + memcpy(s, data, len); ((char *)s)[len] = '\0'; } return s; @@ -182,7 +183,7 @@ heim_string_create_with_format(const char *fmt, ...) if (ret < 0 || str == NULL) return NULL; - s = heim_string_ref_create(str, string_dealloc); + s = heim_string_ref_create(str, free); if (s == NULL) free(str); return s; @@ -238,7 +239,7 @@ heim_string_t __heim_string_constant(const char *_str) { static HEIMDAL_MUTEX mutex = HEIMDAL_MUTEX_INITIALIZER; - static heim_base_once_t once; + static heim_base_once_t once = HEIM_BASE_ONCE_INIT; static heim_dict_t dict = NULL; heim_string_t s, s2; |
