summaryrefslogtreecommitdiff
path: root/libmisc/fmt.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-26 14:58:07 -0400
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-26 17:10:36 -0400
commitcf4af09e9a20e9cdaec4b3896eb6d10c27f89eba (patch)
tree016f876531f7dfc822be17f686074f0c859fd508 /libmisc/fmt.c
parent42fb27570262b52e2ca889030c621b5f4af76fe1 (diff)
No more (static inline) function bodies in headers
Diffstat (limited to 'libmisc/fmt.c')
-rw-r--r--libmisc/fmt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libmisc/fmt.c b/libmisc/fmt.c
index 6cf1d8d..d3ca14a 100644
--- a/libmisc/fmt.c
+++ b/libmisc/fmt.c
@@ -14,6 +14,20 @@ static const char *const hexdig = "0123456789ABCDEF";
/* small/trivial formatters ***************************************************/
+void fmt_print_mem(lo_interface fmt_dest w, const void *_str, size_t size) {
+ const uint8_t *str = _str;
+ while (size--)
+ fmt_print_byte(w, *(str++));
+}
+void fmt_print_str(lo_interface fmt_dest w, const char *str) {
+ while (*str)
+ fmt_print_byte(w, *(str++));
+}
+void fmt_print_strn(lo_interface fmt_dest w, const char *str, size_t size) {
+ while (size-- && *str)
+ fmt_print_byte(w, *(str++));
+}
+
void fmt_print_byte(lo_interface fmt_dest w, uint8_t b) {
LO_CALL(w, putb, b);
}