summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-04-08 08:29:40 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-04-08 08:29:40 -0700
commita5a13a9eb0cb2ab0627192dce684ccb61e59678a (patch)
treeaa910acd37d249277839673f0f7395896a621f68
parentc374939e9e2cf36fcb6aa1984a472d73b05a821d (diff)
Reduce scope of ttydev & ptydev
Eliminates them completely if HAS_OPENPTY is set. Resolves gcc warnings: xconsole.c: In function ‘get_pty’: xconsole.c:792:35: warning: declaration of ‘ttydev’ shadows a global declaration [-Wshadow] get_pty(int *pty, int *tty, char *ttydev, char *ptydev) ^~~~~~ xconsole.c:181:13: note: shadowed declaration is here static char ttydev[64], ptydev[64]; ^~~~~~ xconsole.c:792:49: warning: declaration of ‘ptydev’ shadows a global declaration [-Wshadow] get_pty(int *pty, int *tty, char *ttydev, char *ptydev) ^~~~~~ xconsole.c:181:25: note: shadowed declaration is here static char ttydev[64], ptydev[64]; ^~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xconsole.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/xconsole.c b/xconsole.c
index 031e228..3a0020f 100644
--- a/xconsole.c
+++ b/xconsole.c
@@ -178,7 +178,6 @@ static XrmOptionDescRec options[] = {
# if defined(TIOCCONS) || defined(SRIOCSREDIR)
# define USE_PTY
static int tty_fd, pty_fd;
-static char ttydev[64], ptydev[64];
# endif
#endif
@@ -188,7 +187,7 @@ static char ttydev[64], ptydev[64];
#endif
#ifdef USE_PTY
-static int get_pty(int *pty, int *tty, char *ttydev, char *ptydev);
+static int get_pty(int *pty, int *tty);
#endif
#ifdef USE_OSM
@@ -243,7 +242,7 @@ OpenConsole(void)
#endif
#ifdef USE_PTY
- if (!input && get_pty (&pty_fd, &tty_fd, ttydev, ptydev) == 0)
+ if (!input && get_pty (&pty_fd, &tty_fd) == 0)
{
# ifdef TIOCCONS
int on = 1;
@@ -789,14 +788,17 @@ ScrollLine(Widget w)
*/
static int
-get_pty(int *pty, int *tty, char *ttydev, char *ptydev)
+get_pty(int *pty, int *tty)
{
#ifdef HAS_OPENPTY
if (openpty(pty, tty, NULL, NULL, NULL) == -1) {
return 1;
}
return 0;
-#elif defined (SVR4) || defined (USE_PTS)
+#else
+ static char ttydev[64], ptydev[64];
+
+#if defined (SVR4) || defined (USE_PTS)
#if defined (_AIX)
if ((*pty = open ("/dev/ptc", O_RDWR)) < 0)
#else
@@ -856,6 +858,7 @@ get_pty(int *pty, int *tty, char *ttydev, char *ptydev)
* condition and let our caller terminate cleanly.
*/
return(1);
+#endif /* HAS_OPENPTY */
}
#endif