From bc430e9f80e622833faeea7252d6ba5aa5552bcb Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 26 Oct 2010 09:34:11 +0100 Subject: Clarify comments based on feedback from Richard Braakman. --- dynstr.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/dynstr.h b/dynstr.h index 4009c62..401dc85 100644 --- a/dynstr.h +++ b/dynstr.h @@ -125,22 +125,24 @@ Dynstr *dynstr_cat(Dynstr *dynstr, ...); * the offset is past the end of the string, -1 is returned. */ int dynstr_byte_at(Dynstr *dynstr, size_t offset); -/* Copy contents of a dynamic string into a memory area. If the dynamic - * string is not long enough, or the offset is past the end of the string, - * the copy is truncated. Return number of bytes copied. */ +/* Copy contents of a dynamic string into a memory area. If the offset or + * size extends past the end of the string, the copy is silently truncated + * to include only as much as actually exists in the string. The rest of the + * output memory area will be filled with garbage. Return number of bytes + * actually copied, which may be less than requested, and may be zero. */ size_t dynstr_memcpy(void *mem, Dynstr *dynstr, size_t offset, size_t size); /* Search for first or last byte with a given value in a string, - * within a given range. Return offset of matching byte, or - * DYNSTR_NOT_FOUND if not found. Offset is from beginning of string, - * not beginning of range. */ + * starting at a given offset and until the end of the string. Return offset + * of matching byte, or DYNSTR_NOT_FOUND if not found. Offset is from + * beginning of string. */ size_t dynstr_first_byte(Dynstr *dynstr, size_t offset, int byte); size_t dynstr_last_byte(Dynstr *dynstr, size_t offset, int byte); /* Search for first or last occurrence of a substring in a string, - * within a given range. Return offset of match, or - * DYNSTR_NOT_FOUND if not found. Offset is from beginning of string, - * not beginning of range. */ + * starting at a given offset and until the end of the string. Return + * offset of match, or DYNSTR_NOT_FOUND if not found. Offset is from + * beginning of string. */ size_t dynstr_first_string(Dynstr *dynstr, size_t offset, Dynstr *pattern); size_t dynstr_last_string(Dynstr *dynstr, size_t offset, Dynstr *pattern); -- cgit v1.2.1