Fri Mar 12 19:14:18 2021 UTC ()
indent: make output_string inline

GCC 9.3.0 didn't notice that the argument to this function is always a
string literal, which makes it worthwhile to inline the call.


(rillig)
diff -r1.28 -r1.29 src/usr.bin/indent/io.c

cvs diff -r1.28 -r1.29 src/usr.bin/indent/io.c (expand / switch to unified diff)

--- src/usr.bin/indent/io.c 2021/03/12 19:11:29 1.28
+++ src/usr.bin/indent/io.c 2021/03/12 19:14:18 1.29
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: io.c,v 1.28 2021/03/12 19:11:29 rillig Exp $ */ 1/* $NetBSD: io.c,v 1.29 2021/03/12 19:14:18 rillig Exp $ */
2 2
3/*- 3/*-
4 * SPDX-License-Identifier: BSD-4-Clause 4 * SPDX-License-Identifier: BSD-4-Clause
5 * 5 *
6 * Copyright (c) 1985 Sun Microsystems, Inc. 6 * Copyright (c) 1985 Sun Microsystems, Inc.
7 * Copyright (c) 1980, 1993 7 * Copyright (c) 1980, 1993
8 * The Regents of the University of California. All rights reserved. 8 * The Regents of the University of California. All rights reserved.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -36,27 +36,27 @@ @@ -36,27 +36,27 @@
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE. 37 * SUCH DAMAGE.
38 */ 38 */
39 39
40#if 0 40#if 0
41#ifndef lint 41#ifndef lint
42static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; 42static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
43#endif /* not lint */ 43#endif /* not lint */
44#endif 44#endif
45 45
46#include <sys/cdefs.h> 46#include <sys/cdefs.h>
47#ifndef lint 47#ifndef lint
48#if defined(__NetBSD__) 48#if defined(__NetBSD__)
49__RCSID("$NetBSD: io.c,v 1.28 2021/03/12 19:11:29 rillig Exp $"); 49__RCSID("$NetBSD: io.c,v 1.29 2021/03/12 19:14:18 rillig Exp $");
50#elif defined(__FreeBSD__) 50#elif defined(__FreeBSD__)
51__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); 51__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
52#endif 52#endif
53#endif 53#endif
54 54
55#include <ctype.h> 55#include <ctype.h>
56#include <err.h> 56#include <err.h>
57#include <stdio.h> 57#include <stdio.h>
58#include <stdlib.h> 58#include <stdlib.h>
59#include <string.h> 59#include <string.h>
60#include <stdarg.h> 60#include <stdarg.h>
61 61
62#include "indent.h" 62#include "indent.h"
@@ -67,27 +67,27 @@ static int pad_output(int current, int t @@ -67,27 +67,27 @@ static int pad_output(int current, int t
67 67
68static void 68static void
69output_char(char ch) 69output_char(char ch)
70{ 70{
71 fputc(ch, output); 71 fputc(ch, output);
72} 72}
73 73
74static void 74static void
75output_range(const char *s, const char *e) 75output_range(const char *s, const char *e)
76{ 76{
77 fwrite(s, 1, (size_t)(e - s), output); 77 fwrite(s, 1, (size_t)(e - s), output);
78} 78}
79 79
80static void 80static inline void
81output_string(const char *s) 81output_string(const char *s)
82{ 82{
83 output_range(s, s + strlen(s)); 83 output_range(s, s + strlen(s));
84} 84}
85 85
86static void 86static void
87output_int(int i) 87output_int(int i)
88{ 88{
89 fprintf(output, "%d", i); 89 fprintf(output, "%d", i);
90} 90}
91 91
92/* 92/*
93 * dump_line is the routine that actually effects the printing of the new 93 * dump_line is the routine that actually effects the printing of the new