Fix a bunch of unimportant "Local variable hides global variable" warnings from the LGTM bot.diff -r1.341 -r1.342 src/sys/arch/amd64/amd64/machdep.c
(maxv)
--- src/sys/arch/amd64/amd64/machdep.c 2019/11/14 17:09:23 1.341
+++ src/sys/arch/amd64/amd64/machdep.c 2019/12/06 08:35:21 1.342
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: machdep.c,v 1.341 2019/11/14 17:09:23 maxv Exp $ */ | 1 | /* $NetBSD: machdep.c,v 1.342 2019/12/06 08:35:21 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 | 4 | * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 | |
5 | * The NetBSD Foundation, Inc. | 5 | * The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace | 9 | * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace | |
10 | * Simulation Facility, NASA Ames Research Center. | 10 | * Simulation Facility, NASA Ames Research Center. | |
11 | * | 11 | * | |
12 | * This code is derived from software contributed to The NetBSD Foundation | 12 | * This code is derived from software contributed to The NetBSD Foundation | |
13 | * by Coyote Point Systems, Inc. which was written under contract to Coyote | 13 | * by Coyote Point Systems, Inc. which was written under contract to Coyote | |
14 | * Point by Jed Davis and Devon O'Dell. | 14 | * Point by Jed Davis and Devon O'Dell. | |
@@ -100,27 +100,27 @@ | @@ -100,27 +100,27 @@ | |||
100 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 100 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
101 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 101 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
102 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 102 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
103 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 103 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
104 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 104 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
105 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 105 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
106 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 106 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
107 | * SUCH DAMAGE. | 107 | * SUCH DAMAGE. | |
108 | * | 108 | * | |
109 | * @(#)machdep.c 7.4 (Berkeley) 6/3/91 | 109 | * @(#)machdep.c 7.4 (Berkeley) 6/3/91 | |
110 | */ | 110 | */ | |
111 | 111 | |||
112 | #include <sys/cdefs.h> | 112 | #include <sys/cdefs.h> | |
113 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.341 2019/11/14 17:09:23 maxv Exp $"); | 113 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.342 2019/12/06 08:35:21 maxv Exp $"); | |
114 | 114 | |||
115 | #include "opt_modular.h" | 115 | #include "opt_modular.h" | |
116 | #include "opt_user_ldt.h" | 116 | #include "opt_user_ldt.h" | |
117 | #include "opt_ddb.h" | 117 | #include "opt_ddb.h" | |
118 | #include "opt_kgdb.h" | 118 | #include "opt_kgdb.h" | |
119 | #include "opt_cpureset_delay.h" | 119 | #include "opt_cpureset_delay.h" | |
120 | #include "opt_mtrr.h" | 120 | #include "opt_mtrr.h" | |
121 | #include "opt_realmem.h" | 121 | #include "opt_realmem.h" | |
122 | #include "opt_xen.h" | 122 | #include "opt_xen.h" | |
123 | #include "opt_svs.h" | 123 | #include "opt_svs.h" | |
124 | #include "opt_kaslr.h" | 124 | #include "opt_kaslr.h" | |
125 | #ifndef XENPV | 125 | #ifndef XENPV | |
126 | #include "opt_physmem.h" | 126 | #include "opt_physmem.h" | |
@@ -902,45 +902,45 @@ dump_seg_iter(int (*callback)(paddr_t, p | @@ -902,45 +902,45 @@ dump_seg_iter(int (*callback)(paddr_t, p | |||
902 | 902 | |||
903 | for (i = 0; i < mem_cluster_cnt; ++i) { | 903 | for (i = 0; i < mem_cluster_cnt; ++i) { | |
904 | #ifndef NO_SPARSE_DUMP | 904 | #ifndef NO_SPARSE_DUMP | |
905 | /* | 905 | /* | |
906 | * The bitmap is scanned within each memory segment, | 906 | * The bitmap is scanned within each memory segment, | |
907 | * rather than over its entire domain, in case any | 907 | * rather than over its entire domain, in case any | |
908 | * pages outside of the memory proper have been mapped | 908 | * pages outside of the memory proper have been mapped | |
909 | * into kva; they might be devices that wouldn't | 909 | * into kva; they might be devices that wouldn't | |
910 | * appreciate being arbitrarily read, and including | 910 | * appreciate being arbitrarily read, and including | |
911 | * them could also break the assumption that a sparse | 911 | * them could also break the assumption that a sparse | |
912 | * dump will always be smaller than a full one. | 912 | * dump will always be smaller than a full one. | |
913 | */ | 913 | */ | |
914 | if (sparse_dump && sparse_dump_physmap) { | 914 | if (sparse_dump && sparse_dump_physmap) { | |
915 | paddr_t p, start, end; | 915 | paddr_t p, sp_start, sp_end; | |
916 | int lastset; | 916 | int lastset; | |
917 | 917 | |||
918 | start = mem_clusters[i].start; | 918 | sp_start = mem_clusters[i].start; | |
919 | end = start + mem_clusters[i].size; | 919 | sp_end = sp_start + mem_clusters[i].size; | |
920 | start = rounddown(start, PAGE_SIZE); /* unnecessary? */ | 920 | sp_start = rounddown(sp_start, PAGE_SIZE); /* unnecessary? */ | |
921 | lastset = 0; | 921 | lastset = 0; | |
922 | for (p = start; p < end; p += PAGE_SIZE) { | 922 | for (p = sp_start; p < sp_end; p += PAGE_SIZE) { | |
923 | int thisset = isset(sparse_dump_physmap, | 923 | int thisset = isset(sparse_dump_physmap, | |
924 | p/PAGE_SIZE); | 924 | p/PAGE_SIZE); | |
925 | 925 | |||
926 | if (!lastset && thisset) | 926 | if (!lastset && thisset) | |
927 | start = p; | 927 | sp_start = p; | |
928 | if (lastset && !thisset) | 928 | if (lastset && !thisset) | |
929 | CALLBACK(start, p - start); | 929 | CALLBACK(sp_start, p - sp_start); | |
930 | lastset = thisset; | 930 | lastset = thisset; | |
931 | } | 931 | } | |
932 | if (lastset) | 932 | if (lastset) | |
933 | CALLBACK(start, p - start); | 933 | CALLBACK(sp_start, p - sp_start); | |
934 | } else | 934 | } else | |
935 | #endif | 935 | #endif | |
936 | CALLBACK(mem_clusters[i].start, mem_clusters[i].size); | 936 | CALLBACK(mem_clusters[i].start, mem_clusters[i].size); | |
937 | } | 937 | } | |
938 | return 0; | 938 | return 0; | |
939 | #undef CALLBACK | 939 | #undef CALLBACK | |
940 | } | 940 | } | |
941 | 941 | |||
942 | /* | 942 | /* | |
943 | * Prepare for an impending core dump: decide what's being dumped and | 943 | * Prepare for an impending core dump: decide what's being dumped and | |
944 | * how much space it will take up. | 944 | * how much space it will take up. | |
945 | */ | 945 | */ | |
946 | void | 946 | void |
--- src/sys/compat/common/compat_sysctl_09_43.c 2019/01/27 02:08:39 1.2
+++ src/sys/compat/common/compat_sysctl_09_43.c 2019/12/06 08:35:21 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: compat_sysctl_09_43.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */ | 1 | /* $NetBSD: compat_sysctl_09_43.c,v 1.3 2019/12/06 08:35:21 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1989, 1993 | 4 | * Copyright (c) 1989, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * (c) UNIX System Laboratories, Inc. | 6 | * (c) UNIX System Laboratories, Inc. | |
7 | * All or some portions of this file are derived from material licensed | 7 | * All or some portions of this file are derived from material licensed | |
8 | * to the University of California by American Telephone and Telegraph | 8 | * to the University of California by American Telephone and Telegraph | |
9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
10 | * the permission of UNIX System Laboratories, Inc. | 10 | * the permission of UNIX System Laboratories, Inc. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. | |
35 | * | 35 | * | |
36 | * @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94 | 36 | * @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94 | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.3 2019/12/06 08:35:21 maxv Exp $"); | |
41 | 41 | |||
42 | #if defined(_KERNEL_OPT) | 42 | #if defined(_KERNEL_OPT) | |
43 | #include "opt_compat_netbsd.h" | 43 | #include "opt_compat_netbsd.h" | |
44 | #endif | 44 | #endif | |
45 | 45 | |||
46 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
47 | #include <sys/systm.h> | 47 | #include <sys/systm.h> | |
48 | #include <sys/filedesc.h> | 48 | #include <sys/filedesc.h> | |
49 | #include <sys/kernel.h> | 49 | #include <sys/kernel.h> | |
50 | #include <sys/proc.h> | 50 | #include <sys/proc.h> | |
51 | #include <sys/malloc.h> | 51 | #include <sys/malloc.h> | |
52 | #include <sys/sysctl.h> | 52 | #include <sys/sysctl.h> | |
53 | #include <sys/module.h> | 53 | #include <sys/module.h> | |
@@ -119,40 +119,40 @@ compat_sysctl_vfs(struct sysctllog **clo | @@ -119,40 +119,40 @@ compat_sysctl_vfs(struct sysctllog **clo | |||
119 | 119 | |||
120 | error = sysctl_createv(clog, 0, NULL, NULL, | 120 | error = sysctl_createv(clog, 0, NULL, NULL, | |
121 | CTLFLAG_PERMANENT, | 121 | CTLFLAG_PERMANENT, | |
122 | CTLTYPE_STRUCT, "conf", | 122 | CTLTYPE_STRUCT, "conf", | |
123 | SYSCTL_DESCR("Filesystem configuration information"), | 123 | SYSCTL_DESCR("Filesystem configuration information"), | |
124 | sysctl_vfs_generic_conf, 0, NULL, | 124 | sysctl_vfs_generic_conf, 0, NULL, | |
125 | sizeof(struct vfsconf), | 125 | sizeof(struct vfsconf), | |
126 | CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL); | 126 | CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL); | |
127 | 127 | |||
128 | return error; | 128 | return error; | |
129 | } | 129 | } | |
130 | #endif | 130 | #endif | |
131 | 131 | |||
132 | static struct sysctllog *clog = NULL; | 132 | static struct sysctllog *compat_09_43_clog = NULL; | |
133 | 133 | |||
134 | int | 134 | int | |
135 | compat_sysctl_09_43_init(void) | 135 | compat_sysctl_09_43_init(void) | |
136 | { | 136 | { | |
137 | 137 | |||
138 | return compat_sysctl_vfs(&clog); | 138 | return compat_sysctl_vfs(&compat_09_43_clog); | |
139 | } | 139 | } | |
140 | 140 | |||
141 | int | 141 | int | |
142 | compat_sysctl_09_43_fini(void) | 142 | compat_sysctl_09_43_fini(void) | |
143 | { | 143 | { | |
144 | 144 | |||
145 | sysctl_teardown(&clog); | 145 | sysctl_teardown(&compat_09_43_clog); | |
146 | return 0; | 146 | return 0; | |
147 | } | 147 | } | |
148 | 148 | |||
149 | MODULE (MODULE_CLASS_EXEC, compat_sysctl_09_43, NULL); | 149 | MODULE (MODULE_CLASS_EXEC, compat_sysctl_09_43, NULL); | |
150 | 150 | |||
151 | static int | 151 | static int | |
152 | compat_sysctl_09_43_modcmd(modcmd_t cmd, void *arg) | 152 | compat_sysctl_09_43_modcmd(modcmd_t cmd, void *arg) | |
153 | { | 153 | { | |
154 | 154 | |||
155 | switch (cmd) { | 155 | switch (cmd) { | |
156 | case MODULE_CMD_INIT: | 156 | case MODULE_CMD_INIT: | |
157 | return compat_sysctl_09_43_init(); | 157 | return compat_sysctl_09_43_init(); | |
158 | case MODULE_CMD_FINI: | 158 | case MODULE_CMD_FINI: |
--- src/sys/kern/tty_subr.c 2017/06/01 02:45:13 1.41
+++ src/sys/kern/tty_subr.c 2019/12/06 08:35:21 1.42
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: tty_subr.c,v 1.41 2017/06/01 02:45:13 chs Exp $ */ | 1 | /* $NetBSD: tty_subr.c,v 1.42 2019/12/06 08:35:21 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1993, 1994 Theo de Raadt | 4 | * Copyright (c) 1993, 1994 Theo de Raadt | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Per Lindqvist <pgd@compuram.bbt.se> supplied an almost fully working | 7 | * Per Lindqvist <pgd@compuram.bbt.se> supplied an almost fully working | |
8 | * set of true clist functions that this is very loosely based on. | 8 | * set of true clist functions that this is very loosely based on. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -19,27 +19,27 @@ | @@ -19,27 +19,27 @@ | |||
19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: tty_subr.c,v 1.41 2017/06/01 02:45:13 chs Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: tty_subr.c,v 1.42 2019/12/06 08:35:21 maxv Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/buf.h> | 36 | #include <sys/buf.h> | |
37 | #include <sys/ioctl.h> | 37 | #include <sys/ioctl.h> | |
38 | #include <sys/tty.h> | 38 | #include <sys/tty.h> | |
39 | #include <sys/kmem.h> | 39 | #include <sys/kmem.h> | |
40 | 40 | |||
41 | /* | 41 | /* | |
42 | * At compile time, choose: | 42 | * At compile time, choose: | |
43 | * There are two ways the TTY_QUOTE bit can be stored. If QBITS is | 43 | * There are two ways the TTY_QUOTE bit can be stored. If QBITS is | |
44 | * defined we allocate an array of bits -- 1/8th as much memory but | 44 | * defined we allocate an array of bits -- 1/8th as much memory but | |
45 | * setbit(), clrbit(), and isset() take more CPU. If QBITS is | 45 | * setbit(), clrbit(), and isset() take more CPU. If QBITS is | |
@@ -368,49 +368,49 @@ b_to_q(const u_char *cp, int count, stru | @@ -368,49 +368,49 @@ b_to_q(const u_char *cp, int count, stru | |||
368 | } | 368 | } | |
369 | p += cc; | 369 | p += cc; | |
370 | count -= cc; | 370 | count -= cc; | |
371 | clp->c_cc += cc; | 371 | clp->c_cc += cc; | |
372 | clp->c_cl += cc; | 372 | clp->c_cl += cc; | |
373 | if (clp->c_cl == clp->c_ce) | 373 | if (clp->c_cl == clp->c_ce) | |
374 | clp->c_cl = clp->c_cs; | 374 | clp->c_cl = clp->c_cs; | |
375 | } | 375 | } | |
376 | out: | 376 | out: | |
377 | splx(s); | 377 | splx(s); | |
378 | return count; | 378 | return count; | |
379 | } | 379 | } | |
380 | 380 | |||
381 | static int cc; | 381 | static int tty_global_cc; | |
382 | 382 | |||
383 | /* | 383 | /* | |
384 | * Given a non-NULL pointer into the clist return the pointer | 384 | * Given a non-NULL pointer into the clist return the pointer | |
385 | * to the next character in the list or return NULL if no more chars. | 385 | * to the next character in the list or return NULL if no more chars. | |
386 | * | 386 | * | |
387 | * Callers must not allow getc's to happen between firstc's and getc's | 387 | * Callers must not allow getc's to happen between firstc's and getc's | |
388 | * so that the pointer becomes invalid. Note that interrupts are NOT | 388 | * so that the pointer becomes invalid. Note that interrupts are NOT | |
389 | * masked. | 389 | * masked. | |
390 | */ | 390 | */ | |
391 | u_char * | 391 | u_char * | |
392 | nextc(struct clist *clp, u_char *cp, int *c) | 392 | nextc(struct clist *clp, u_char *cp, int *c) | |
393 | { | 393 | { | |
394 | 394 | |||
395 | if (clp->c_cf == cp) { | 395 | if (clp->c_cf == cp) { | |
396 | /* | 396 | /* | |
397 | * First time initialization. | 397 | * First time initialization. | |
398 | */ | 398 | */ | |
399 | cc = clp->c_cc; | 399 | tty_global_cc = clp->c_cc; | |
400 | } | 400 | } | |
401 | if (cc == 0 || cp == NULL) | 401 | if (tty_global_cc == 0 || cp == NULL) | |
402 | return NULL; | 402 | return NULL; | |
403 | if (--cc == 0) | 403 | if (--tty_global_cc == 0) | |
404 | return NULL; | 404 | return NULL; | |
405 | if (++cp == clp->c_ce) | 405 | if (++cp == clp->c_ce) | |
406 | cp = clp->c_cs; | 406 | cp = clp->c_cs; | |
407 | *c = *cp & 0xff; | 407 | *c = *cp & 0xff; | |
408 | if (clp->c_cq) { | 408 | if (clp->c_cq) { | |
409 | #ifdef QBITS | 409 | #ifdef QBITS | |
410 | if (isset(clp->c_cq, cp - clp->c_cs)) | 410 | if (isset(clp->c_cq, cp - clp->c_cs)) | |
411 | *c |= TTY_QUOTE; | 411 | *c |= TTY_QUOTE; | |
412 | #else | 412 | #else | |
413 | if (*(clp->c_cf - clp->c_cs + clp->c_cq)) | 413 | if (*(clp->c_cf - clp->c_cs + clp->c_cq)) | |
414 | *c |= TTY_QUOTE; | 414 | *c |= TTY_QUOTE; | |
415 | #endif | 415 | #endif | |
416 | } | 416 | } | |
@@ -422,28 +422,28 @@ nextc(struct clist *clp, u_char *cp, int | @@ -422,28 +422,28 @@ nextc(struct clist *clp, u_char *cp, int | |||
422 | * to the first character in the list or return NULL if no more chars. | 422 | * to the first character in the list or return NULL if no more chars. | |
423 | * | 423 | * | |
424 | * Callers must not allow getc's to happen between firstc's and getc's | 424 | * Callers must not allow getc's to happen between firstc's and getc's | |
425 | * so that the pointer becomes invalid. Note that interrupts are NOT | 425 | * so that the pointer becomes invalid. Note that interrupts are NOT | |
426 | * masked. | 426 | * masked. | |
427 | * | 427 | * | |
428 | * *c is set to the NEXT character | 428 | * *c is set to the NEXT character | |
429 | */ | 429 | */ | |
430 | u_char * | 430 | u_char * | |
431 | firstc(struct clist *clp, int *c) | 431 | firstc(struct clist *clp, int *c) | |
432 | { | 432 | { | |
433 | u_char *cp; | 433 | u_char *cp; | |
434 | 434 | |||
435 | cc = clp->c_cc; | 435 | tty_global_cc = clp->c_cc; | |
436 | if (cc == 0) | 436 | if (tty_global_cc == 0) | |
437 | return NULL; | 437 | return NULL; | |
438 | cp = clp->c_cf; | 438 | cp = clp->c_cf; | |
439 | *c = *cp & 0xff; | 439 | *c = *cp & 0xff; | |
440 | if (clp->c_cq) { | 440 | if (clp->c_cq) { | |
441 | #ifdef QBITS | 441 | #ifdef QBITS | |
442 | if (isset(clp->c_cq, cp - clp->c_cs)) | 442 | if (isset(clp->c_cq, cp - clp->c_cs)) | |
443 | *c |= TTY_QUOTE; | 443 | *c |= TTY_QUOTE; | |
444 | #else | 444 | #else | |
445 | if (*(cp - clp->c_cs + clp->c_cq)) | 445 | if (*(cp - clp->c_cs + clp->c_cq)) | |
446 | *c |= TTY_QUOTE; | 446 | *c |= TTY_QUOTE; | |
447 | #endif | 447 | #endif | |
448 | } | 448 | } | |
449 | return clp->c_cf; | 449 | return clp->c_cf; |