tweaks: adjust two comments, to better fit the actual functions

master
Benno Schulenberg 2019-10-15 16:21:50 +02:00
parent 17c16a4bf5
commit f26c121ca9
1 changed files with 3 additions and 4 deletions

View File

@ -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;