Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v3/GSoC 2/5] path.c: implement xdg_runtime_dir()

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:09:04
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

惠轶群 [off-list ref] 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 *);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help