]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
auxdisplay: charlcd: use null character instead of zero literal to terminate strings
authorRobert Abel <rabel@robertabel.eu>
Fri, 9 Feb 2018 23:50:11 +0000 (00:50 +0100)
committerMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Thu, 12 Apr 2018 17:02:43 +0000 (19:02 +0200)
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: Robert Abel <rabel@robertabel.eu>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
drivers/auxdisplay/charlcd.c

index 45ec5ce697c41a1e14c6b85c7ffca9afdfb720aa..b61cea36add5d81425c04de6e7ab708435529d4d 100644 (file)
@@ -528,7 +528,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
        if ((c != '\n') && priv->esc_seq.len >= 0) {
                /* 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] = 0;
+               priv->esc_seq.buf[priv->esc_seq.len] = '\0';
        } else {
                /* aborts any previous escape sequence */
                priv->esc_seq.len = -1;
@@ -537,7 +537,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
                case LCD_ESCAPE_CHAR:
                        /* start of an escape sequence */
                        priv->esc_seq.len = 0;
-                       priv->esc_seq.buf[priv->esc_seq.len] = 0;
+                       priv->esc_seq.buf[priv->esc_seq.len] = '\0';
                        break;
                case '\b':
                        /* go back one char and clear it */