summaryrefslogtreecommitdiff
path: root/py/mpprint.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-04-11 13:03:37 +0100
committerDamien George <damien.p.george@gmail.com>2015-04-16 14:30:16 +0000
commit044c473de203b4dbe93874813b430fb6336db2b2 (patch)
treef632b62412031458b7a9438fa144ef5a6ebd1f66 /py/mpprint.c
parente72cda99fd5fc9e7c6476eb8574c4401d3ef9560 (diff)
py: Add %q format support to mp_[v]printf, and use it.
Diffstat (limited to 'py/mpprint.c')
-rw-r--r--py/mpprint.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/py/mpprint.c b/py/mpprint.c
index cb39aa813..99d0357af 100644
--- a/py/mpprint.c
+++ b/py/mpprint.c
@@ -489,6 +489,17 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
chrs += mp_print_strn(print, &str, 1, flags, fill, width);
break;
}
+ case 'q':
+ {
+ qstr qst = va_arg(args, qstr);
+ mp_uint_t len;
+ const char *str = (const char*)qstr_data(qst, &len);
+ if (prec < 0) {
+ prec = len;
+ }
+ chrs += mp_print_strn(print, str, prec, flags, fill, width);
+ break;
+ }
case 's':
{
const char *str = va_arg(args, const char*);