Commit be02381c authored by Paul Eggert's avatar 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.
parent 57048744
2011-03-17 Paul Eggert <eggert@cs.ucla.edu> 2011-03-17 Paul Eggert <eggert@cs.ucla.edu>
* 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. * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling.
* process.c (allocate_pty): Don't declare stb unless it's needed. * process.c (allocate_pty): Don't declare stb unless it's needed.
...@@ -535,12 +535,12 @@ static char pty_name[24]; ...@@ -535,12 +535,12 @@ static char pty_name[24];
static int static int
allocate_pty (void) allocate_pty (void)
{ {
register int c, i;
int fd; int fd;
#ifdef PTY_ITERATION #ifdef PTY_ITERATION
PTY_ITERATION PTY_ITERATION
#else #else
register int c, i;
for (c = FIRST_PTY_LETTER; c <= 'z'; c++) for (c = FIRST_PTY_LETTER; c <= 'z'; c++)
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
#endif #endif
......
...@@ -32,7 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -32,7 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* In AIX, you allocate a pty by opening /dev/ptc to get the master side. /* 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. */ 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_NAME_SPRINTF strcpy (pty_name, "/dev/ptc");
#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd)); #define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd));
......
...@@ -46,7 +46,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -46,7 +46,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define HAVE_PTYS if the system supports pty devices. */ /* Define HAVE_PTYS if the system supports pty devices. */
#define HAVE_PTYS #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_NAME_SPRINTF /* none */
#define PTY_TTY_NAME_SPRINTF /* none */ #define PTY_TTY_NAME_SPRINTF /* none */
#define PTY_OPEN \ #define PTY_OPEN \
...@@ -102,4 +102,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -102,4 +102,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Send signals to subprocesses by "typing" special chars at them. */ /* Send signals to subprocesses by "typing" special chars at them. */
#define SIGNALS_VIA_CHARACTERS #define SIGNALS_VIA_CHARACTERS
...@@ -68,7 +68,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -68,7 +68,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
Note: PTYs are broken on darwin <6. Use at your own risk. */ Note: PTYs are broken on darwin <6. Use at your own risk. */
#define HAVE_PTYS #define HAVE_PTYS
/* Run only once. We need a `for'-loop because the code uses `continue'. */ /* 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_NAME_SPRINTF /* none */
#define PTY_TTY_NAME_SPRINTF /* none */ #define PTY_TTY_NAME_SPRINTF /* none */
/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8. /* 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 <http://www.gnu.org/licenses/>. */ ...@@ -148,4 +148,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */ /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */
#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
...@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define UNIX98_PTYS #define UNIX98_PTYS
/* Run only once. We need a `for'-loop because the code uses `continue'. */ /* 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 #ifdef HAVE_GETPT
#define PTY_NAME_SPRINTF #define PTY_NAME_SPRINTF
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment