Received: by 10.223.185.116 with SMTP id b49csp25928wrg; Sat, 10 Feb 2018 01:30:05 -0800 (PST) X-Google-Smtp-Source: AH8x227sKPCkWZZKLAWEHKiksdgxw764l01IlX4kDCQBjPCnZmM+H4HNtF+XYzUTrds+af1thHxP X-Received: by 2002:a17:902:6bca:: with SMTP id m10-v6mr5042530plt.351.1518255005588; Sat, 10 Feb 2018 01:30:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518255005; cv=none; d=google.com; s=arc-20160816; b=lUAisM0EwC0p8zt7fS492tQhfDbPqgkeNxYxvilJx7rzdTLKqfeMvaKJd+TZYXlCI2 g491a6R25AKK3wVihMLryjY4cnGdP31FyTV1+KnblqkFv9AXn2bLV+lHmyT5N9HYPFX/ w6V3coGe/JmWC3B1wBqQlDg5bAuSMMr4CgtUYn5SyBoZGAg858pBbyMWxUHqsHYEbqPX AJhNfdWM2sNKSc5p8s8svgSjaY9CJuvgW7s+Z9vEPjPo7zqGWXmTmvYCvzDk8+PzJDNa uaReIEQmXXifnz1wU3lHuHWX5buAfA0/FX8kAK7nhmzPj5BcGTGM3RcTmc6PXKPRuskk 95gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=LNpxT8wzElRbvl2iGEG/Jb8+S5+UOOTwxpWs/I3GABY=; b=kidhW2eHVr68m7Vx0VqRvKa9g3vO5iUp8BGptWD4Hka+kpVj3kMUKvqzdwG7wZ2r65 vQjMvIbj3o5o3ZuBBeddl0qocvayXwCrItFpDYhHw8MkRjY/V8An2hSYcbyyBbL44TIG h2BCbdckJIoEBN0dLcuQmWT+qtr2huM46+LVFfK8Cj005bhpWOUwfSg15+TZjLZjK0f7 lZuvP0e78X/TYrK90o4km5NEZ4Q6rPo9+KAwgzU+yfVQJEuJH1qrXWo5upe14/J6SZHi GsGxaQeVx+tksFQPmKFVPB6zVRfpFeaShlsLPMNGahhUoUAfNw6q5E1R0iFBv1bow6M8 IkCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KVyQ4l+b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o74si722397pfj.76.2018.02.10.01.29.51; Sat, 10 Feb 2018 01:30:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KVyQ4l+b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751026AbeBJJ3N (ORCPT + 99 others); Sat, 10 Feb 2018 04:29:13 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:44305 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750832AbeBJJ3M (ORCPT ); Sat, 10 Feb 2018 04:29:12 -0500 Received: by mail-qt0-f193.google.com with SMTP id f18so13388416qth.11 for ; Sat, 10 Feb 2018 01:29:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LNpxT8wzElRbvl2iGEG/Jb8+S5+UOOTwxpWs/I3GABY=; b=KVyQ4l+bLIJyFdTTuVH9pLoLlKSX/ttiHEcckiSngvoCg2rWjNzYhiD3xCityW9EyX vLAO0oyHCRK22JshSZWQIR2YZmySmmkuKYkskcO+yj+iZlChtPLbtLuhlzbENwMeQOgM PNme32z2hdbF0P8vPiBYWzOd3TBIZyZbt3E9QBK2sn5P2W0nSUmPdf1nVJ7I/l1Ohj+0 SD8gl21xHOdMG0f2UXHbgPjCg6l8tKsT7t181zC2B/RKF1lxd8Gp9StC6BSf6+sBqVB4 5ixiJCHix9OWlNPuvv/B+CoprYPgUlI0lnIZExWBUC5NUqIPc1wrVQNl+f4bvrKnHiII mZhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LNpxT8wzElRbvl2iGEG/Jb8+S5+UOOTwxpWs/I3GABY=; b=lsulmBodj5iq6ANrCa71s8EB8J4j3NBEinCzBnUy+u+o5NLcsN787qa6TpiIOjzPQL ouQGtDez1UYlfMwx/FltUBUzv2E2gyTzqw7u5UhzSIm4HC5ZhPyD8r2tUIHBvEOaYQqu hkLaJABjFuU5PfjSWfwJZ9lj+t262VIrQDdjqLVScAIdN/I4VflHcfHkav7+KJkpsY/K INwrGcBk6wQmRcUdqeU8gvxQ3pZIhfF03DS+27BNf9KSZTgcWpLjay3bNcU1ePRFqkA1 KoVUNYhlxuPIOMVQaM1l1LatCvYhBBCVA3ak1KIGmOtBGAlyQ7MKDRhGDTxfM62cAWeT pVwA== X-Gm-Message-State: APf1xPDNDFA8yH0Yu3VKOZAT9ZzmQsNNZXUHVzRmnZbGPuLHpIojPk7m JSVP1wyh9AufHoYgV88TPvGEQC9UMorjkSKnDkwehw== X-Received: by 10.200.9.86 with SMTP id z22mr8811060qth.87.1518254951641; Sat, 10 Feb 2018 01:29:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.26.7 with HTTP; Sat, 10 Feb 2018 01:29:11 -0800 (PST) In-Reply-To: <20180209235012.4993-3-rabel@robertabel.eu> References: <20180209235012.4993-1-rabel@robertabel.eu> <20180209235012.4993-2-rabel@robertabel.eu> <20180209235012.4993-3-rabel@robertabel.eu> From: Miguel Ojeda Date: Sat, 10 Feb 2018 10:29:11 +0100 Message-ID: Subject: Re: [PATCH 2/3] auxdisplay: charlcd: use null character instead of zero literal to terminate strings To: Robert Abel Cc: linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 10, 2018 at 12:50 AM, Robert Abel wrote: > 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 > --- > drivers/auxdisplay/charlcd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c > index 324d02f9f1c5..92549c8344a4 100644 > --- a/drivers/auxdisplay/charlcd.c > +++ b/drivers/auxdisplay/charlcd.c > @@ -527,7 +527,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; > @@ -536,7 +536,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'; Trivial. Compile-tested. Signed-off-by: Miguel Ojeda > break; > case '\b': > /* go back one char and clear it */ > -- > 2.11.0 >