From 3778baee1b66951d92dbb25fc897879f2db008c8 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 17 May 2021 08:53:53 -0400 Subject: [PATCH] TT#14008 use const char in str_init_dup Change-Id: I57246916f472d4d2f61611c401e2324b97329bb6 --- lib/str.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/str.h b/lib/str.h index a098c6743..fc957eb02 100644 --- a/lib/str.h +++ b/lib/str.h @@ -61,7 +61,7 @@ INLINE str *str_init_len(str *out, char *s, size_t len); INLINE str *str_init_len_assert_len(str *out, char *s, size_t buflen, size_t len); #define str_init_len_assert(out, s, len) str_init_len_assert_len(out, s, sizeof(s), len) /* inits a str object from a regular string and duplicates the contents. returns out */ -INLINE str *str_init_dup(str *out, char *s); +INLINE str *str_init_dup(str *out, const char *s); INLINE str *str_init_dup_str(str *out, const str *s); INLINE void str_free_dup(str *out); /* returns new str object with uninitialized buffer large enough to hold `len` characters (+1 for null byte) */ @@ -232,7 +232,7 @@ INLINE str *str_init_len_assert_len(str *out, char *s, size_t buflen, size_t len assert(buflen >= len); return str_init_len(out, s, len); } -INLINE str *str_init_dup(str *out, char *s) { +INLINE str *str_init_dup(str *out, const char *s) { out->s = s ? strdup(s) : NULL; out->len = s ? strlen(s) : 0; return out;