1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib: Add dump_data_addbuf()

Helper function to build up debug strings

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2023-02-09 17:38:15 +01:00 committed by Jeremy Allison
parent e5d1527f74
commit bbcc9b326e
2 changed files with 15 additions and 0 deletions

View File

@ -828,6 +828,17 @@ _PUBLIC_ void dump_data_pw(const char *msg, const uint8_t * data, size_t len)
#endif #endif
} }
static void dump_data_addbuf_cb(const char *buf, void *private_data)
{
char **str = private_data;
talloc_asprintf_addbuf(str, "%s", buf);
}
_PUBLIC_ void dump_data_addbuf(const uint8_t *buf, size_t buflen, char **str)
{
dump_data_cb(buf, buflen, false, dump_data_addbuf_cb, str);
}
/** /**
* see if a range of memory is all zero. A NULL pointer is considered * see if a range of memory is all zero. A NULL pointer is considered

View File

@ -87,4 +87,8 @@ _PUBLIC_ void dump_data_file_diff(FILE *f,
*/ */
_PUBLIC_ void dump_data_pw(const char *msg, const uint8_t * data, size_t len); _PUBLIC_ void dump_data_pw(const char *msg, const uint8_t * data, size_t len);
/**
* Dump data to "str" via talloc_asprintf_addbuf()
*/
_PUBLIC_ void dump_data_addbuf(const uint8_t *buf, size_t buflen, char **str);
#endif #endif