+// SPDX-License-Identifier: LGPL-2.1+
/*
* Tiny printf version for SPL
*
* http://www.sparetimelabs.com/printfrevisited/printfrevisited.php
*
* Copyright (C) 2004,2008 Kustaa Nyholm
- *
- * SPDX-License-Identifier: LGPL-2.1+
*/
#include <common.h>
* decimal).
*/
-static void pointer(struct printf_info *info, const char *fmt, void *ptr)
+static void __maybe_unused pointer(struct printf_info *info, const char *fmt,
+ void *ptr)
{
#ifdef DEBUG
unsigned long num = (uintptr_t)ptr;
div_out(info, &num, div);
}
break;
+ case 'p':
+#ifdef DEBUG
+ pointer(info, fmt, va_arg(va, void *));
+ /*
+ * Skip this because it pulls in _ctype which is
+ * 256 bytes, and we don't generally implement
+ * pointer anyway
+ */
+ while (isalnum(fmt[0]))
+ fmt++;
+ break;
+#else
+ islong = true;
+ /* no break */
+#endif
case 'x':
if (islong) {
num = va_arg(va, unsigned long);
case 's':
p = va_arg(va, char*);
break;
- case 'p':
- pointer(info, fmt, va_arg(va, void *));
- while (isalnum(fmt[0]))
- fmt++;
- break;
case '%':
out(info, '%');
default:
return ret;
}
+#if CONFIG_IS_ENABLED(LOG)
+/* Note that size is ignored */
+int vsnprintf(char *buf, size_t size, const char *fmt, va_list va)
+{
+ struct printf_info info;
+ int ret;
+
+ info.outstr = buf;
+ info.putc = putc_outstr;
+ ret = _vprintf(&info, fmt, va);
+ *info.outstr = '\0';
+
+ return ret;
+}
+#endif
+
/* Note that size is ignored */
int snprintf(char *buf, size_t size, const char *fmt, ...)
{
return ret;
}
+
+void print_grouped_ull(unsigned long long int_val, int digits)
+{
+ /* Don't try to print the upper 32-bits */
+ printf("%ld ", (ulong)int_val);
+}