Skip to content

Commit

Permalink
uric & print: use %W for printing escaped characters
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianfridrich committed Mar 23, 2023
1 parent 0889e4c commit 17fa4a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
14 changes: 4 additions & 10 deletions src/fmt/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,10 @@ int re_vhprintf(const char *fmt, va_list ap, re_vprintf_h *vph, void *arg)
}

len = local_itoa(num, n, base, uc);
if (fpad != (size_t)-1) {
err |= write_padded(num + len - fpad, fpad, 0,
plr ? ' ' : pch, plr, NULL,
vph, arg);
}
else {
err |= write_padded(num, len, pad,
plr ? ' ' : pch, plr, NULL,
vph, arg);
}

err |= write_padded(num, len, pad,
plr ? ' ' : pch, plr, NULL,
vph, arg);
break;

case 'v':
Expand Down
5 changes: 1 addition & 4 deletions src/uri/uric.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ static int comp_escape(struct re_printf *pf, const struct pl *pl, esc_h *eh)
err = pf->vph(&c, 1, pf->arg);
}
else {
if (c < 0)
err = re_hprintf(pf, "%%%02.X", c);
else
err = re_hprintf(pf, "%%%02X", c);
err = re_hprintf(pf, "%%%W", &c, 1);
}
}

Expand Down

0 comments on commit 17fa4a4

Please sign in to comment.