commit f26c121ca90f8edf841759bf97d3164a9e14cf94
parent 17c16a4bf597d4bc7cf3ddc8ffc9db807bf7dc50
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 15 Oct 2019 16:21:50 +0200
tweaks: adjust two comments, to better fit the actual functions
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/utils.c b/src/utils.c
@@ -312,8 +312,7 @@ void *nrealloc(void *ptr, size_t howmuch)
return r;
}
-/* Allocate and copy the first n characters of the given src string, after
- * freeing the destination. Usage: "dest = mallocstrncpy(dest, src, n);". */
+/* Return an allocated copy of the first n characters of the given string. */
char *measured_copy(const char *src, size_t n)
{
char *dest = charalloc(n);
@@ -323,8 +322,8 @@ char *measured_copy(const char *src, size_t n)
return dest;
}
-/* Free the dest string and return a malloc'ed copy of src. Should be used as:
- * "dest = mallocstrcpy(dest, src);". */
+/* Return an appropriately reallocated dest string holding a copy of src.
+ * Usage: "dest = mallocstrcpy(dest, src);". */
char *mallocstrcpy(char *dest, const char *src)
{
size_t count = strlen(src) + 1;