aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mds-kbdc/include-stack.c3
-rw-r--r--src/mds-kbdc/raw-data.c3
-rw-r--r--src/mds-kbdc/string.c3
3 files changed, 3 insertions, 6 deletions
diff --git a/src/mds-kbdc/include-stack.c b/src/mds-kbdc/include-stack.c
index b34b57b..d9225a3 100644
--- a/src/mds-kbdc/include-stack.c
+++ b/src/mds-kbdc/include-stack.c
@@ -199,8 +199,7 @@ mds_kbdc_include_stack_t* mds_kbdc_include_stack_save(void)
if (latest_save->ptr == 0)
return latest_save;
- fail_if (xmalloc(latest_save->stack, latest_save->ptr, const mds_kbdc_tree_include_t*));
- memcpy(latest_save->stack, includes, latest_save->ptr * sizeof(const mds_kbdc_tree_include_t*));
+ fail_if (xmemdup(latest_save->stack, includes, latest_save->ptr, const mds_kbdc_tree_include_t*));
return latest_save;
fail:
diff --git a/src/mds-kbdc/raw-data.c b/src/mds-kbdc/raw-data.c
index cf48486..d8976ec 100644
--- a/src/mds-kbdc/raw-data.c
+++ b/src/mds-kbdc/raw-data.c
@@ -408,8 +408,7 @@ int read_source_lines(const char* restrict pathname, mds_kbdc_source_code_t* res
}
/* Simplify file. */
- fail_if (xmalloc(real_content, content_size, char));
- memcpy(real_content, content, content_size * sizeof(char));
+ fail_if (xmemdup(real_content, content, content_size, char));
real_content_size = content_size;
content_size = remove_comments(content, content_size);
fail_if (xxrealloc(old, content, content_size, char));
diff --git a/src/mds-kbdc/string.c b/src/mds-kbdc/string.c
index 6ecf757..843757b 100644
--- a/src/mds-kbdc/string.c
+++ b/src/mds-kbdc/string.c
@@ -145,8 +145,7 @@ char32_t* string_dup(const char32_t* restrict string)
if (string == NULL)
return NULL;
n = string_length(string) + 1;
- fail_if (xmalloc(rc, n, char32_t));
- memcpy(rc, string, n * sizeof(char32_t));
+ fail_if (xmemdup(rc, string, n, char32_t));
return rc;
fail:
return NULL;