summaryrefslogtreecommitdiff
path: root/Documentation/technical/api-strbuf.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/technical/api-strbuf.txt')
-rw-r--r--Documentation/technical/api-strbuf.txt20
1 files changed, 17 insertions, 3 deletions
diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt
index a9668e5..ac56d1c 100644
--- a/Documentation/technical/api-strbuf.txt
+++ b/Documentation/technical/api-strbuf.txt
@@ -21,7 +21,7 @@ allocated memory or not), use `strbuf_detach()` to unwrap a memory
buffer from its strbuf shell in a safe way. That is the sole supported
way. This will give you a malloced buffer that you can later `free()`.
+
-However, it it totally safe to modify anything in the string pointed by
+However, it is totally safe to modify anything in the string pointed by
the `buf` member, between the indices `0` and `len-1` (inclusive).
. The `buf` member is a byte array that has at least `len + 1` bytes
@@ -133,8 +133,10 @@ Functions
* Adding data to the buffer
-NOTE: All of these functions in this section will grow the buffer as
- necessary.
+NOTE: All of the functions in this section will grow the buffer as necessary.
+If they fail for some reason other than memory shortage and the buffer hadn't
+been allocated before (i.e. the `struct strbuf` was set to `STRBUF_INIT`),
+then they will free() it.
`strbuf_addch`::
@@ -205,6 +207,13 @@ In order to facilitate caching and to make it possible to give
parameters to the callback, `strbuf_expand()` passes a context pointer,
which can be used by the programmer of the callback as she sees fit.
+`strbuf_expand_dict_cb`::
+
+ Used as callback for `strbuf_expand()`, expects an array of
+ struct strbuf_expand_dict_entry as context, i.e. pairs of
+ placeholder and replacement string. The array needs to be
+ terminated by an entry with placeholder set to NULL.
+
`strbuf_addf`::
Add a formatted string to the buffer.
@@ -228,6 +237,11 @@ same behaviour as well.
Read the contents of a file, specified by its path. The third argument
can be used to give a hint about the file size, to avoid reallocs.
+`strbuf_readlink`::
+
+ Read the target of a symbolic link, specified by its path. The third
+ argument can be used to give a hint about the size, to avoid reallocs.
+
`strbuf_getline`::
Read a line from a FILE* pointer. The second argument specifies the line