From 72bf06393da44b17f7d6d6ae7843aa2ead17c71b Mon Sep 17 00:00:00 2001 From: William McBrine Date: Sun, 13 Aug 2006 02:11:36 +0000 Subject: [PATCH] Made "regs" a local in each function where it's used. --- dos/pdcdisp.c | 8 +++++++- dos/pdcdos.h | 4 +--- dos/pdcgetsc.c | 15 +++++++++++---- dos/pdckbd.c | 7 ++++++- dos/pdcscrn.c | 4 +--- dos/pdcsetsc.c | 9 ++++++++- 6 files changed, 34 insertions(+), 13 deletions(-) diff --git a/dos/pdcdisp.c b/dos/pdcdisp.c index dc564462..427d4965 100644 --- a/dos/pdcdisp.c +++ b/dos/pdcdisp.c @@ -19,7 +19,7 @@ #include -RCSID("$Id: pdcdisp.c,v 1.50 2006/08/12 02:44:08 wmcbrine Exp $"); +RCSID("$Id: pdcdisp.c,v 1.51 2006/08/13 02:11:36 wmcbrine Exp $"); #ifdef __PACIFIC__ void movedata(unsigned sseg, unsigned soff, unsigned dseg, @@ -51,6 +51,8 @@ void movedata(unsigned sseg, unsigned soff, unsigned dseg, void PDC_gotoyx(int row, int col) { + union REGS regs; + PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col)); regs.h.ah = 0x02; @@ -76,6 +78,8 @@ void PDC_gotoyx(int row, int col) static void PDC_putc(chtype ch, unsigned short count) { + union REGS regs; + PDC_LOG(("PDC_putc() - called\n")); regs.h.ah = 0x09; /* Avoid screen wrap. Don't advance cursor. */ @@ -109,6 +113,8 @@ static void PDC_putc(chtype ch, unsigned short count) void PDC_putctty(chtype ch) { + union REGS regs; + PDC_LOG(("PDC_putctty() - called\n")); regs.h.ah = 0x0e; /* Write in TTY fashion, advance cursor. */ diff --git a/dos/pdcdos.h b/dos/pdcdos.h index a05bc08e..21eac45d 100644 --- a/dos/pdcdos.h +++ b/dos/pdcdos.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: pdcdos.h,v 1.11 2006/08/12 20:11:36 wmcbrine Exp $ */ +/* $Id: pdcdos.h,v 1.12 2006/08/13 02:11:36 wmcbrine Exp $ */ #define CURSES_LIBRARY 1 #include @@ -53,8 +53,6 @@ #include -extern union REGS regs; - extern int pdc_adapter; extern int pdc_scrnmode; extern int pdc_font; diff --git a/dos/pdcgetsc.c b/dos/pdcgetsc.c index 6b1071b7..2f359366 100644 --- a/dos/pdcgetsc.c +++ b/dos/pdcgetsc.c @@ -19,7 +19,7 @@ #include -RCSID("$Id: pdcgetsc.c,v 1.30 2006/08/12 02:44:08 wmcbrine Exp $"); +RCSID("$Id: pdcgetsc.c,v 1.31 2006/08/13 02:11:36 wmcbrine Exp $"); /*man-start************************************************************** @@ -46,6 +46,8 @@ RCSID("$Id: pdcgetsc.c,v 1.30 2006/08/12 02:44:08 wmcbrine Exp $"); int PDC_get_cursor_pos(int *row, int *col) { + union REGS regs; + PDC_LOG(("PDC_get_cursor_pos() - called\n")); regs.h.ah = 0x03; @@ -80,8 +82,9 @@ int PDC_get_cursor_pos(int *row, int *col) int PDC_get_columns(void) { + union REGS regs; int cols; - char *env_cols; + const char *env_cols; PDC_LOG(("PDC_get_columns() - called\n")); @@ -91,9 +94,10 @@ int PDC_get_columns(void) regs.h.ah = 0x0f; int86(0x10, ®s, ®s); cols = (int)regs.h.ah; - env_cols = (char *)getenv("COLS"); - if (env_cols != (char *)NULL) + env_cols = getenv("COLS"); + + if (env_cols) cols = min(atoi(env_cols), cols); PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols)); @@ -263,6 +267,8 @@ int PDC_get_rows(void) int PDC_get_scrn_mode(void) { + union REGS regs; + PDC_LOG(("PDC_get_scrn_mode() - called\n")); regs.h.ah = 0x0f; @@ -371,6 +377,7 @@ static int PDC_sanity_check(int adapter) int PDC_query_adapter_type(void) { + union REGS regs; int equip; int retval = _NONE; diff --git a/dos/pdckbd.c b/dos/pdckbd.c index 2801607a..c682bbe8 100644 --- a/dos/pdckbd.c +++ b/dos/pdckbd.c @@ -23,7 +23,7 @@ #include "pdcdos.h" -RCSID("$Id: pdckbd.c,v 1.34 2006/08/12 22:22:05 wmcbrine Exp $"); +RCSID("$Id: pdckbd.c,v 1.35 2006/08/13 02:11:36 wmcbrine Exp $"); /************************************************************************ * Table for key code translation of function keys in keypad mode * @@ -190,6 +190,7 @@ bool PDC_check_bios_key(void) int PDC_get_bios_key(void) { + union REGS regs; int ascii, scan; static unsigned char keyboard_function = 0xFF; @@ -317,6 +318,8 @@ int PDC_get_bios_key(void) bool PDC_get_ctrl_break(void) { + union REGS regs; + PDC_LOG(("PDC_get_ctrl_break() - called\n")); regs.h.ah = 0x33; @@ -347,6 +350,8 @@ bool PDC_get_ctrl_break(void) int PDC_set_ctrl_break(bool setting) { + union REGS regs; + PDC_LOG(("PDC_set_ctrl_break() - called\n")); #ifdef __DJGPP__ diff --git a/dos/pdcscrn.c b/dos/pdcscrn.c index 9b11079b..dac01e64 100644 --- a/dos/pdcscrn.c +++ b/dos/pdcscrn.c @@ -24,9 +24,7 @@ # include #endif -RCSID("$Id: pdcscrn.c,v 1.48 2006/08/12 22:22:05 wmcbrine Exp $"); - -union REGS regs; /* used in various other modules */ +RCSID("$Id: pdcscrn.c,v 1.49 2006/08/13 02:11:36 wmcbrine Exp $"); int pdc_adapter; /* screen type */ int pdc_scrnmode; /* default screen mode */ diff --git a/dos/pdcsetsc.c b/dos/pdcsetsc.c index 4e9150c6..0c55a1e0 100644 --- a/dos/pdcsetsc.c +++ b/dos/pdcsetsc.c @@ -17,7 +17,7 @@ #include "pdcdos.h" -RCSID("$Id: pdcsetsc.c,v 1.24 2006/08/12 20:11:36 wmcbrine Exp $"); +RCSID("$Id: pdcsetsc.c,v 1.25 2006/08/13 02:11:36 wmcbrine Exp $"); /*man-start************************************************************** @@ -38,6 +38,8 @@ RCSID("$Id: pdcsetsc.c,v 1.24 2006/08/12 20:11:36 wmcbrine Exp $"); int PDC_set_80x25(void) { + union REGS regs; + PDC_LOG(("PDC_set_80x25() - called\n")); switch (pdc_adapter) @@ -88,6 +90,8 @@ int PDC_set_80x25(void) int PDC_set_font(int size) { + union REGS regs; + PDC_LOG(("PDC_set_font() - called\n")); if (pdc_bogus_adapter) @@ -175,6 +179,8 @@ int PDC_set_font(int size) int PDC_set_scrn_mode(int new_mode) { + union REGS regs; + PDC_LOG(("PDC_set_scrn_mode() - called\n")); if (PDC_get_scrn_mode() != new_mode) @@ -194,6 +200,7 @@ int PDC_set_scrn_mode(int new_mode) int PDC_curs_set(int visibility) { + union REGS regs; int ret_vis, start, end = 7; PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));