svn commit: samba r11961 - in trunk/source: . lib utils
tridge at samba.org
tridge at samba.org
Wed Nov 30 00:14:39 GMT 2005
Jeremy,
> re-add the talloc_describe_all() function.
It looks like this is a copy of the talloc_report_full() function, but
with a different output routine. Perhaps we are better off creating a
a varient of talloc_report_*() that takes a function pointer?
This function pointer could either be a fprintf() style of function,
but with a void* private pointer for the 'file', or we could instead
make it a function that takes the details of a specific allocation as
arguments, and allows the caller to format it as they wish.
I think the latter is probably more useful, particularly as it allows
for things like GUIs, web interfaces etc, without them having to try
and parse the human-readable output.
So, how about this for a interface:
void talloc_report_function(void *ptr, talloc_report_fn_t fn, void *private);
typedef void (*talloc_report_fn_t)(void *, void *, size_t, const char *, int);
a simple report function would be:
void my_report(void *private, void *ptr, size_t size, const char *name, int is_reference)
{
if (is_reference) {
printf("reference to %p\n", ptr);
} else {
printf("ptr %p of size %u has name '%s'\n", ptr, size, name);
}
}
talloc_report_function() would only traverse the direct children of
the pointer, leaving it up to the callback function to recurse if it
wants to.
Cheers, Tridge
More information about the samba-technical
mailing list