diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-08-15 12:32:23 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-08-15 12:32:23 +0100 |
commit | 6a6536afd9c12b70c66bc9e53623eb6530b2ca73 (patch) | |
tree | 6c97014baa4be8358c388bfaef3e104ddf82955d /src/libutil/mem_pool.c | |
parent | 028a29f991f98aff5c838145e6dd6fbebd07d187 (diff) | |
download | rspamd-6a6536afd9c12b70c66bc9e53623eb6530b2ca73.tar.gz rspamd-6a6536afd9c12b70c66bc9e53623eb6530b2ca73.zip |
[Rework] Further conversion routines
Diffstat (limited to 'src/libutil/mem_pool.c')
-rw-r--r-- | src/libutil/mem_pool.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c index 12fb761b1..edfb3c016 100644 --- a/src/libutil/mem_pool.c +++ b/src/libutil/mem_pool.c @@ -605,14 +605,18 @@ rspamd_mempool_alloc_shared_(rspamd_mempool_t *pool, gsize size, gsize alignment gchar * rspamd_mempool_strdup_(rspamd_mempool_t *pool, const gchar *src, const gchar *loc) { - gsize len; + return rspamd_mempool_strdup_len_(pool, src, strlen(src), loc); +} + +gchar * +rspamd_mempool_strdup_len_(rspamd_mempool_t *pool, const gchar *src, gsize len, const gchar *loc) +{ gchar *newstr; if (src == NULL) { return NULL; } - len = strlen(src); newstr = rspamd_mempool_alloc_(pool, len + 1, MIN_MEM_ALIGNMENT, loc); memcpy(newstr, src, len); newstr[len] = '\0'; |