summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-10-26 09:34:11 +0100
committerLars Wirzenius <liw@liw.fi>2010-10-26 09:34:11 +0100
commitbc430e9f80e622833faeea7252d6ba5aa5552bcb (patch)
tree791220381d8d43cc03d743374f3491516ca509d7
parentb1965eba20eb28010dca4d5965b389420c0c941e (diff)
downloaddynstr-bc430e9f80e622833faeea7252d6ba5aa5552bcb.tar.gz
Clarify comments based on feedback from Richard Braakman.
-rw-r--r--dynstr.h20
1 files 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);