Skip to content

Commit

Permalink
Add output function with zero character at the end.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Aug 24, 2020
1 parent 3a41d38 commit 53bf9d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lwprintf/src/lwprintf/lwprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ prv_rotate_string(char* str, size_t len) {
static int
prv_out_fn_print(lwprintf_int_t* p, const char c) {
p->lw->out_fn(c, p->lw); /*!< Send character to output */
++p->n;
if (c != '\0') {
++p->n;
}
return 1;
}

Expand Down Expand Up @@ -349,7 +351,6 @@ prv_out_str(lwprintf_int_t* p, const char* buff, size_t buff_size) {
if (buff_size == 0) {
buff_size = strlen(buff);
}

prv_out_str_before(p, buff_size); /* Implement pre-format */
prv_out_str_raw(p, buff, buff_size); /* Print actual string */
prv_out_str_after(p, buff_size); /* Implement post-format */
Expand Down Expand Up @@ -778,6 +779,7 @@ prv_format(lwprintf_int_t* p, va_list arg) {
}
++fmt;
}
p->out_fn(p, '\0'); /* Output last zero number */
#if LWPRINTF_CFG_OS
lwprintf_sys_mutex_release(&p->lw);
#endif /* LWPRINTF_CFG_OS */
Expand Down

0 comments on commit 53bf9d7

Please sign in to comment.