Skip to content

Commit

Permalink
remove temporary variable (charlesnicholson#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesnicholson authored Nov 24, 2022
1 parent 83bd7e9 commit c2d00b2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nanoprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,9 @@ int npf_vpprintf(npf_putc pc, void *pc_ctx, char const *format, va_list args) {
case NPF_FMT_SPEC_CONV_STRING: {
cbuf = va_arg(args, char *);
#if NANOPRINTF_USE_PRECISION_FORMAT_SPECIFIERS == 1
int const n = (fs.prec_opt == NPF_FMT_SPEC_OPT_NONE) ? -1 : fs.prec;
for (char const *s = cbuf; *s && ((n == -1) || (cbuf_len < n)); ++s, ++cbuf_len);
for (char const *s = cbuf;
*s && ((fs.prec_opt == NPF_FMT_SPEC_OPT_NONE) || (cbuf_len < fs.prec));
++s, ++cbuf_len);
#else
for (char const *s = cbuf; *s; ++s, ++cbuf_len); // strlen
#endif
Expand Down

0 comments on commit c2d00b2

Please sign in to comment.