Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint lint: move outqchar from common to lint1



details:   https://anonhg.NetBSD.org/src/rev/2076aa96f5dc
branches:  trunk
changeset: 985696:2076aa96f5dc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 04 14:48:27 2021 +0000

description:
lint: move outqchar from common to lint1

diffstat:

 usr.bin/xlint/common/emit.c    |  55 +----------------------------------------
 usr.bin/xlint/common/externs.h |   3 +-
 usr.bin/xlint/lint1/emit1.c    |  54 +++++++++++++++++++++++++++++++++++++++-
 3 files changed, 55 insertions(+), 57 deletions(-)

diffs (168 lines):

diff -r cdcf41132b7d -r 2076aa96f5dc usr.bin/xlint/common/emit.c
--- a/usr.bin/xlint/common/emit.c       Sat Sep 04 14:42:30 2021 +0000
+++ b/usr.bin/xlint/common/emit.c       Sat Sep 04 14:48:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emit.c,v 1.15 2021/09/04 14:42:30 rillig Exp $ */
+/*     $NetBSD: emit.c,v 1.16 2021/09/04 14:48:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit.c,v 1.15 2021/09/04 14:42:30 rillig Exp $");
+__RCSID("$NetBSD: emit.c,v 1.16 2021/09/04 14:48:27 rillig Exp $");
 #endif
 
 #include <stdio.h>
@@ -131,57 +131,6 @@
        *ob.o_next++ = c;
 }
 
-#if defined(IS_LINT1)
-/* write a character to the output buffer, quoted if necessary */
-void
-outqchar(char c)
-{
-
-       if (ch_isprint(c) && c != '\\' && c != '"' && c != '\'') {
-               outchar(c);
-       } else {
-               outchar('\\');
-               switch (c) {
-               case '\\':
-                       outchar('\\');
-                       break;
-               case '"':
-                       outchar('"');
-                       break;
-               case '\'':
-                       outchar('\'');
-                       break;
-               case '\b':
-                       outchar('b');
-                       break;
-               case '\t':
-                       outchar('t');
-                       break;
-               case '\n':
-                       outchar('n');
-                       break;
-               case '\f':
-                       outchar('f');
-                       break;
-               case '\r':
-                       outchar('r');
-                       break;
-               case '\v':
-                       outchar('v');
-                       break;
-               case '\a':
-                       outchar('a');
-                       break;
-               default:
-                       outchar((char)((((unsigned char)c >> 6) & 07) + '0'));
-                       outchar((char)((((unsigned char)c >> 3) & 07) + '0'));
-                       outchar((char)((c & 07) + '0'));
-                       break;
-               }
-       }
-}
-#endif
-
 /*
  * write a string to the output buffer
  * the string must not contain any characters which
diff -r cdcf41132b7d -r 2076aa96f5dc usr.bin/xlint/common/externs.h
--- a/usr.bin/xlint/common/externs.h    Sat Sep 04 14:42:30 2021 +0000
+++ b/usr.bin/xlint/common/externs.h    Sat Sep 04 14:48:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs.h,v 1.23 2021/09/04 14:42:30 rillig Exp $      */
+/*     $NetBSD: externs.h,v 1.24 2021/09/04 14:48:27 rillig Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -60,7 +60,6 @@
 extern void    outclose(void);
 extern void    outclr(void);
 extern void    outchar(char);
-extern void    outqchar(char);
 extern void    outstrg(const char *);
 extern void    outint(int);
 extern void    outname(const char *);
diff -r cdcf41132b7d -r 2076aa96f5dc usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c       Sat Sep 04 14:42:30 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c       Sat Sep 04 14:48:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.55 2021/09/04 14:26:32 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.56 2021/09/04 14:48:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.55 2021/09/04 14:26:32 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.56 2021/09/04 14:48:27 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -431,6 +431,56 @@
        outtype(tn->tn_type);
 }
 
+/* write a character to the output buffer, quoted if necessary */
+static void
+outqchar(char c)
+{
+
+       if (ch_isprint(c) && c != '\\' && c != '"' && c != '\'') {
+               outchar(c);
+               return;
+       }
+
+       outchar('\\');
+       switch (c) {
+       case '\\':
+               outchar('\\');
+               break;
+       case '"':
+               outchar('"');
+               break;
+       case '\'':
+               outchar('\'');
+               break;
+       case '\b':
+               outchar('b');
+               break;
+       case '\t':
+               outchar('t');
+               break;
+       case '\n':
+               outchar('n');
+               break;
+       case '\f':
+               outchar('f');
+               break;
+       case '\r':
+               outchar('r');
+               break;
+       case '\v':
+               outchar('v');
+               break;
+       case '\a':
+               outchar('a');
+               break;
+       default:
+               outchar((char)((((unsigned char)c >> 6) & 07) + '0'));
+               outchar((char)((((unsigned char)c >> 3) & 07) + '0'));
+               outchar((char)((c & 07) + '0'));
+               break;
+       }
+}
+
 /*
  * extracts potential format specifiers for printf() and scanf() and
  * writes them, enclosed in "" and quoted if necessary, to the output buffer



Home | Main Index | Thread Index | Old Index