basic/memory-util: introduce mempcpy_typesafe

This commit is contained in:
Mike Yuan
2024-09-20 08:29:35 +09:00
committed by Yu Watanabe
parent 48837c6500
commit eda6223942
7 changed files with 16 additions and 14 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ static int map_string_field_internal(
if (!c)
return -ENOMEM;
*((char*) mempcpy(stpcpy(c, field), s, e - s)) = 0;
*mempcpy_typesafe(stpcpy(c, field), s, e - s) = 0;
e += 1;
+7 -7
View File
@@ -1066,13 +1066,13 @@ static void server_write_to_journal(
iovec[n++] = IOVEC_MAKE_STRING(k); \
}
#define IOVEC_ADD_SIZED_FIELD(iovec, n, value, value_size, field) \
if (value_size > 0) { \
char *k; \
k = newa(char, STRLEN(field "=") + value_size + 1); \
*((char*) mempcpy(stpcpy(k, field "="), value, value_size)) = 0; \
iovec[n++] = IOVEC_MAKE_STRING(k); \
} \
#define IOVEC_ADD_SIZED_FIELD(iovec, n, value, value_size, field) \
if (value_size > 0) { \
char *k; \
k = newa(char, STRLEN(field "=") + value_size + 1); \
*mempcpy_typesafe(stpcpy(k, field "="), value, value_size) = 0; \
iovec[n++] = IOVEC_MAKE_STRING(k); \
}
static void server_dispatch_message_real(
Server *s,