惠轶群 <huiyiqun@xxxxxxxxx> writes: > Excuse me, but I could not find > `Documentation/technical/api-strbuf.txt` in master branch. Do you > refer to the header of `strbuf.h`? In which, I learnt how to > initialize the strbuf and how to take use of it when I began to > use it. Ah, yes, it was a relatively recent development that usage text from the former was moved to the latter. > If there is also a note about whether I should release it > and how do it, such as: > > For every strbuf that has been initialized and buffer of it has > not been detached with strbuf_detach, you should release the > resource by strbuf_release. > > It will save me (maybe others) much time to explore the entire method list. While it may not hurt, it sounds somewhat extreme and funny me, as it sounds as if you are saying "for every pointer variable that points at a piece of memory allocated with malloc(3) and friends, you must free(3) them after you are done". The way _release() refers to its internal resource usage could be improved, I guess. "Release ... the memory it used" may not click as freeing the memory to some readers. strbuf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strbuf.h b/strbuf.h index f72fd14..a783f09 100644 --- a/strbuf.h +++ b/strbuf.h @@ -82,7 +82,7 @@ extern char strbuf_slopbuf[]; extern void strbuf_init(struct strbuf *, size_t); /** - * Release a string buffer and the memory it used. You should not use the + * Release a string buffer and free the memory it used. You should not use the * string buffer after using this function, unless you initialize it again. */ extern void strbuf_release(struct strbuf *); -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html