提交 8c483758 编写于 作者: R Robert Abel 提交者: Miguel Ojeda

auxdisplay: charlcd: use null character instead of zero literal to terminate strings

Using '\0' instead of plain 0 makes the intent clearer that this is
indeed a string and not a series of integers.
Signed-off-by: NRobert Abel <rabel@robertabel.eu>
Signed-off-by: NMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
上级 54bc937f
...@@ -528,7 +528,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c) ...@@ -528,7 +528,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
if ((c != '\n') && priv->esc_seq.len >= 0) { if ((c != '\n') && priv->esc_seq.len >= 0) {
/* yes, let's add this char to the buffer */ /* yes, let's add this char to the buffer */
priv->esc_seq.buf[priv->esc_seq.len++] = c; priv->esc_seq.buf[priv->esc_seq.len++] = c;
priv->esc_seq.buf[priv->esc_seq.len] = 0; priv->esc_seq.buf[priv->esc_seq.len] = '\0';
} else { } else {
/* aborts any previous escape sequence */ /* aborts any previous escape sequence */
priv->esc_seq.len = -1; priv->esc_seq.len = -1;
...@@ -537,7 +537,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c) ...@@ -537,7 +537,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
case LCD_ESCAPE_CHAR: case LCD_ESCAPE_CHAR:
/* start of an escape sequence */ /* start of an escape sequence */
priv->esc_seq.len = 0; priv->esc_seq.len = 0;
priv->esc_seq.buf[priv->esc_seq.len] = 0; priv->esc_seq.buf[priv->esc_seq.len] = '\0';
break; break;
case '\b': case '\b':
/* go back one char and clear it */ /* go back one char and clear it */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册