summaryrefslogtreecommitdiff
path: root/libmisc/fmt.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-27 17:48:22 -0400
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-27 19:23:14 -0400
commit65534dca5e71cd81070e2e464060f023b9868600 (patch)
treebc2b1b7c18c8b811b3ecb644e55cf894b27de401 /libmisc/fmt.c
parent148deaba00b5710135ebf4f6ff0577d4a9483654 (diff)
libmisc: fmt: Add hbyte and hmem
Diffstat (limited to 'libmisc/fmt.c')
-rw-r--r--libmisc/fmt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libmisc/fmt.c b/libmisc/fmt.c
index d3ca14a..a8baa84 100644
--- a/libmisc/fmt.c
+++ b/libmisc/fmt.c
@@ -28,6 +28,17 @@ void fmt_print_strn(lo_interface fmt_dest w, const char *str, size_t size) {
fmt_print_byte(w, *(str++));
}
+void fmt_print_hmem(lo_interface fmt_dest w, const void *_str, size_t size) {
+ const uint8_t *str = _str;
+ fmt_print_byte(w, '{');
+ for (size_t i = 0; i < size; i++) {
+ if (i)
+ fmt_print_byte(w, ',');
+ fmt_print_hbyte(w, str[i]);
+ }
+ fmt_print_byte(w, '}');
+}
+
void fmt_print_byte(lo_interface fmt_dest w, uint8_t b) {
LO_CALL(w, putb, b);
}