From be02381c5db4236f51f474726003d5a97bbc61f7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 16 Mar 2011 22:15:08 -0700 Subject: * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars. That way, the code declares only the vars that it needs. * s/aix4-2.h (PTY_ITERATION): Declare iteration vars. * s/cygwin.h (PTY_ITERATION): Likewise. * s/darwin.h (PTY_ITERATION): Likewise. * s/gnu-linux.h (PTY_ITERATION): Likewise. --- src/ChangeLog | 7 +++++++ src/process.c | 2 +- src/s/aix4-2.h | 2 +- src/s/cygwin.h | 3 +-- src/s/darwin.h | 3 +-- src/s/gnu-linux.h | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 45cb41024ae..7e7556f0e85 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2011-03-17 Paul Eggert + * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars. + That way, the code declares only the vars that it needs. + * s/aix4-2.h (PTY_ITERATION): Declare iteration vars. + * s/cygwin.h (PTY_ITERATION): Likewise. + * s/darwin.h (PTY_ITERATION): Likewise. + * s/gnu-linux.h (PTY_ITERATION): Likewise. + * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling. * process.c (allocate_pty): Don't declare stb unless it's needed. diff --git a/src/process.c b/src/process.c index a026174bd23..ab340867150 100644 --- a/src/process.c +++ b/src/process.c @@ -535,12 +535,12 @@ static char pty_name[24]; static int allocate_pty (void) { - register int c, i; int fd; #ifdef PTY_ITERATION PTY_ITERATION #else + register int c, i; for (c = FIRST_PTY_LETTER; c <= 'z'; c++) for (i = 0; i < 16; i++) #endif diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h index 443fc034570..c2715fffe01 100644 --- a/src/s/aix4-2.h +++ b/src/s/aix4-2.h @@ -32,7 +32,7 @@ along with GNU Emacs. If not, see . */ /* In AIX, you allocate a pty by opening /dev/ptc to get the master side. To get the name of the slave side, you just ttyname() the master side. */ -#define PTY_ITERATION for (c = 0; !c ; c++) +#define PTY_ITERATION int c; for (c = 0; !c ; c++) #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc"); #define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd)); diff --git a/src/s/cygwin.h b/src/s/cygwin.h index ceebe23f1e7..af5308ff7bb 100644 --- a/src/s/cygwin.h +++ b/src/s/cygwin.h @@ -46,7 +46,7 @@ along with GNU Emacs. If not, see . */ /* Define HAVE_PTYS if the system supports pty devices. */ #define HAVE_PTYS -#define PTY_ITERATION for (i = 0; i < 1; i++) /* ick */ +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) /* ick */ #define PTY_NAME_SPRINTF /* none */ #define PTY_TTY_NAME_SPRINTF /* none */ #define PTY_OPEN \ @@ -102,4 +102,3 @@ along with GNU Emacs. If not, see . */ /* Send signals to subprocesses by "typing" special chars at them. */ #define SIGNALS_VIA_CHARACTERS - diff --git a/src/s/darwin.h b/src/s/darwin.h index 4fc2f4d1031..dd0d0c34021 100644 --- a/src/s/darwin.h +++ b/src/s/darwin.h @@ -68,7 +68,7 @@ along with GNU Emacs. If not, see . */ Note: PTYs are broken on darwin <6. Use at your own risk. */ #define HAVE_PTYS /* Run only once. We need a `for'-loop because the code uses `continue'. */ -#define PTY_ITERATION for (i = 0; i < 1; i++) +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) #define PTY_NAME_SPRINTF /* none */ #define PTY_TTY_NAME_SPRINTF /* none */ /* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8. @@ -148,4 +148,3 @@ along with GNU Emacs. If not, see . */ /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */ #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS - diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h index 84fe5b92da9..178d7082f72 100644 --- a/src/s/gnu-linux.h +++ b/src/s/gnu-linux.h @@ -44,7 +44,7 @@ along with GNU Emacs. If not, see . */ #define UNIX98_PTYS /* Run only once. We need a `for'-loop because the code uses `continue'. */ -#define PTY_ITERATION for (i = 0; i < 1; i++) +#define PTY_ITERATION int i; for (i = 0; i < 1; i++) #ifdef HAVE_GETPT #define PTY_NAME_SPRINTF -- cgit v1.2.1