summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2001-12-19 06:22:23 +0000
committerMartin Pool <mbp@samba.org>2001-12-19 06:22:23 +0000
commit7da982e9268be7eb93fe7d6ad7da5b33ce44181c (patch)
treec064dc041251642b0aafa3a34b6007104cbb555e
parent5dc2827b6eaca8f7b833fdf9977528084e3a3ff0 (diff)
downloadsamba-7da982e9268be7eb93fe7d6ad7da5b33ce44181c.tar.gz
Doc
-rw-r--r--source/include/talloc.h10
-rw-r--r--source/lib/talloc.c20
2 files changed, 21 insertions, 9 deletions
diff --git a/source/include/talloc.h b/source/include/talloc.h
index fb2fb6a0c39..198a27b49bb 100644
--- a/source/include/talloc.h
+++ b/source/include/talloc.h
@@ -22,6 +22,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+/**
+ * @ingroup talloc
+ * @{
+ * @sa talloc.c
+ */
+
struct talloc_chunk {
struct talloc_chunk *next;
size_t size;
@@ -50,4 +56,6 @@ char *talloc_vasprintf(TALLOC_CTX *t, const char *fmt, va_list ap)
char *talloc_asprintf(TALLOC_CTX *t, const char *fmt, ...)
PRINTF_ATTRIBUTE(2, 3);
-#endif
+/** @} */
+
+#endif /* ndef _TALLOC_H_ */
diff --git a/source/lib/talloc.c b/source/lib/talloc.c
index e20cbbe7cb7..e882af20711 100644
--- a/source/lib/talloc.c
+++ b/source/lib/talloc.c
@@ -36,9 +36,12 @@
talloc does not zero the memory. It guarantees memory of a
TALLOC_ALIGN alignment
+
+ @sa talloc.h
*/
-/* TODO: We could allocate both the talloc_chunk structure, and the
+/**
+ * @todo We could allocate both the talloc_chunk structure, and the
* memory it contains all in one allocation, which might be a bit
* faster and perhaps use less memory overhead.
*
@@ -106,7 +109,7 @@ void *talloc(TALLOC_CTX *t, size_t size)
return p;
}
-/* a talloc version of realloc */
+/** A talloc version of realloc */
void *talloc_realloc(TALLOC_CTX *t, void *ptr, size_t size)
{
struct talloc_chunk *tc;
@@ -133,7 +136,8 @@ void *talloc_realloc(TALLOC_CTX *t, void *ptr, size_t size)
return NULL;
}
-/* destroy a whole pool */
+/** Destroy all the memory allocated inside @p t, but not @p t
+ * itself. */
void talloc_destroy_pool(TALLOC_CTX *t)
{
struct talloc_chunk *c;
@@ -151,7 +155,7 @@ void talloc_destroy_pool(TALLOC_CTX *t)
t->total_alloc_size = 0;
}
-/* destroy a whole pool including the context */
+/** Destroy a whole pool including the context */
void talloc_destroy(TALLOC_CTX *t)
{
if (!t)
@@ -161,13 +165,13 @@ void talloc_destroy(TALLOC_CTX *t)
SAFE_FREE(t);
}
-/* return the current total size of the pool. */
+/** Return the current total size of the pool. */
size_t talloc_pool_size(TALLOC_CTX *t)
{
return t->total_alloc_size;
}
-/* talloc and zero memory. */
+/** talloc and zero memory. */
void *talloc_zero(TALLOC_CTX *t, size_t size)
{
void *p = talloc(t, size);
@@ -178,7 +182,7 @@ void *talloc_zero(TALLOC_CTX *t, size_t size)
return p;
}
-/* memdup with a talloc. */
+/** memdup with a talloc. */
void *talloc_memdup(TALLOC_CTX *t, const void *p, size_t size)
{
void *newp = talloc(t,size);
@@ -191,7 +195,7 @@ void *talloc_memdup(TALLOC_CTX *t, const void *p, size_t size)
return newp;
}
-/* strdup with a talloc */
+/** strdup with a talloc */
char *talloc_strdup(TALLOC_CTX *t, const char *p)
{
return talloc_memdup(t, p, strlen(p) + 1);