From patchwork Wed Jun 7 09:41:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 772312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wjNqZ4dh6z9s7p for ; Wed, 7 Jun 2017 19:41:46 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wjNqZ3rF4zDqL5 for ; Wed, 7 Jun 2017 19:41:46 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wjNqW2NVVzDqKm for ; Wed, 7 Jun 2017 19:41:43 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6438480C1C for ; Wed, 7 Jun 2017 09:41:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6438480C1C Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6438480C1C Received: from thh440s.redhat.com (ovpn-116-81.ams2.redhat.com [10.36.116.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7E6C7444A for ; Wed, 7 Jun 2017 09:41:40 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Wed, 7 Jun 2017 11:41:39 +0200 Message-Id: <1496828499-30874-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 07 Jun 2017 09:41:41 +0000 (UTC) Subject: [SLOF] [PATCH] libc: The arguments of puts() can be marked as "const" X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" puts() does not change the string, so the parameter can be "const". Signed-off-by: Thomas Huth --- lib/libc/include/stdio.h | 2 +- lib/libc/stdio/puts.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/include/stdio.h b/lib/libc/include/stdio.h index 84cddea..c54528f 100644 --- a/lib/libc/include/stdio.h +++ b/lib/libc/include/stdio.h @@ -51,7 +51,7 @@ int setvbuf(FILE *stream, char *buf, int mode , size_t size); int putc(int ch, FILE *stream); int putchar(int ch); -int puts(char *str); +int puts(const char *str); int scanf(const char *format, ...) __attribute__((format (scanf, 1, 2))); int fscanf(FILE *stream, const char *format, ...) __attribute__((format (scanf, 2, 3))); diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c index 3f48dbf..9a93008 100644 --- a/lib/libc/stdio/puts.c +++ b/lib/libc/stdio/puts.c @@ -17,7 +17,7 @@ int -puts(char *str) +puts(const char *str) { int ret;