static void msg_pool_usage_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_s) { const char *name = talloc_get_name(ptr); struct msg_pool_usage_state *state = (struct msg_pool_usage_state *)_s; if (is_ref) { sprintf_append(state->mem_ctx, &state->s, &state->len, &state->buflen, "%*sreference to: %s\n", depth*4, "", name); return; } if (depth == 0) { sprintf_append(state->mem_ctx, &state->s, &state->len, &state->buflen, "%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\n", (max_depth < 0 ? "full " :""), name, (unsigned long)talloc_total_size(ptr), (unsigned long)talloc_total_blocks(ptr)); return; } sprintf_append(state->mem_ctx, &state->s, &state->len, &state->buflen, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d)\n", depth*4, "", name, (unsigned long)talloc_total_size(ptr), (unsigned long)talloc_total_blocks(ptr), talloc_reference_count(ptr)); }
bool print_sidlist(TALLOC_CTX *mem_ctx, const DOM_SID *sids, size_t num_sids, char **result, ssize_t *len) { size_t i; size_t buflen = 0; *len = 0; *result = NULL; for (i=0; i<num_sids; i++) { fstring tmp; sprintf_append(mem_ctx, result, len, &buflen, "%s\n", sid_to_fstring(tmp, &sids[i])); } if ((num_sids != 0) && (*result == NULL)) { return False; } return True; }