1
1

a few cleanups and consistency fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1837 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2004-07-03 03:09:12 +00:00
родитель 72e51ab037
Коммит edab0cc0a5
8 изменённых файлов: 27 добавлений и 19 удалений

Просмотреть файл

@ -6,10 +6,14 @@ CVS code -
- Change more instances of ints that can never be negative to
size_t's. (DLR)
- Convert the shortcut list functions and most related functions
to return void instead of int, as the return values of all
to return void instead of int, as the return values of all
those functions are essentially unused. Changes to
sc_init_one(), shortcut_init(), etc. (David Benbennick and
DLR)
- Make flags and all variables meant to store the value of flags
longs for consistency. (David Benbennick)
- Rename the TEMP_OPT flags to TEMP_FILE, as it's more
descriptive. (DLR)
- files.c:
close_open_file()
- Tweak to no longer rely on the return values of
@ -25,10 +29,14 @@ CVS code -
- Change the last variables in the prototypes for do_justify()
and get_mouseinput() to match the ones used in the actual
functions. (DLR)
- Remove unused declaration of temp_opt. (David Benbennick)
- rcfile.c:
parse_rcfile()
- Have whitespace display default to off instead of on. (Mike
Frysinger)
nregcomp()
- Rename the variable flags to eflags so as not to conflict with
the global flags. (DLR)
- winio.c:
get_control_kbinput()
- Fix erroneous debugging statement so that nano compiles with

Просмотреть файл

@ -1794,7 +1794,7 @@ int do_writeout(int exiting)
currshortcut = writefile_list;
#endif
if (exiting && filename[0] != '\0' && ISSET(TEMP_OPT)) {
if (exiting && filename[0] != '\0' && ISSET(TEMP_FILE)) {
i = write_file(filename, FALSE, 0, FALSE);
if (i == 1) {
/* Write succeeded. */
@ -1901,7 +1901,7 @@ int do_writeout(int exiting)
#endif
#ifdef NANO_EXTRA
if (exiting && !ISSET(TEMP_OPT) && !strcasecmp(answer, "zzy")
if (exiting && !ISSET(TEMP_FILE) && !strcasecmp(answer, "zzy")
&& !did_cred) {
do_credits();
did_cred = TRUE;

Просмотреть файл

@ -39,7 +39,7 @@ char *last_replace = NULL; /* Last replacement string */
int search_last_line; /* Is this the last search line? */
int search_offscreen; /* Search lines not displayed */
int flags = 0; /* Our new flag containing many options */
long flags = 0; /* Our flag containing many options */
WINDOW *edit; /* The file portion of the editor */
WINDOW *topwin; /* Top line of screen */
WINDOW *bottomwin; /* Bottom buffer */

Просмотреть файл

@ -2387,7 +2387,7 @@ void do_justify(int full_justify)
* unjustifies. Note we don't need to save totlines. */
int current_x_save = current_x;
int current_y_save = current_y;
int flags_save = flags;
long flags_save = flags;
long totsize_save = totsize;
filestruct *current_save = current;
filestruct *edittop_save = edittop;
@ -2715,7 +2715,7 @@ void do_exit(void)
if (!ISSET(MODIFIED))
i = 0; /* Pretend the user chose not to save. */
else if (ISSET(TEMP_OPT))
else if (ISSET(TEMP_FILE))
i = 1;
else
i = do_yesno(FALSE,
@ -3234,7 +3234,7 @@ int main(int argc, char *argv[])
break;
#endif
case 't':
SET(TEMP_OPT);
SET(TEMP_FILE);
break;
case 'v':
SET(VIEW_MODE);

Просмотреть файл

@ -264,7 +264,7 @@ typedef struct historyheadtype {
#define VIEW_MODE (1<<9)
#define USE_MOUSE (1<<10)
#define USE_REGEXP (1<<11)
#define TEMP_OPT (1<<12)
#define TEMP_FILE (1<<12)
#define CUT_TO_END (1<<13)
#define REVERSE_SEARCH (1<<14)
#define MULTIBUFFER (1<<15)

Просмотреть файл

@ -39,8 +39,7 @@ extern int placewewant;
extern int mark_beginx;
#endif
extern long totsize;
extern int temp_opt;
extern int flags;
extern long flags;
extern int tabsize;
extern int search_last_line;
extern int search_offscreen;
@ -370,7 +369,7 @@ char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR
int colortoint(const char *colorname, int *bright);
char *parse_next_regex(char *ptr);
int nregcomp(regex_t *preg, const char *regex, int flags);
int nregcomp(regex_t *preg, const char *regex, int eflags);
void parse_syntax(char *ptr);
void parse_colors(char *ptr);
#endif /* ENABLE_COLOR */

Просмотреть файл

@ -92,7 +92,7 @@ const static rcoption rcopts[] = {
#endif
{"suspend", SUSPEND},
{"tabsize", 0},
{"tempfile", TEMP_OPT},
{"tempfile", TEMP_FILE},
{"view", VIEW_MODE},
#ifndef NANO_SMALL
{"whitespace", 0},
@ -253,11 +253,11 @@ char *parse_next_regex(char *ptr)
return ptr;
}
/* Compile the regular expression regex to preg. Returns FALSE on success,
TRUE if the expression is invalid. */
int nregcomp(regex_t *preg, const char *regex, int flags)
/* Compile the regular expression regex to preg. Returns FALSE on
* success, or TRUE if the expression is invalid. */
int nregcomp(regex_t *preg, const char *regex, int eflags)
{
int rc = regcomp(preg, regex, REG_EXTENDED | flags);
int rc = regcomp(preg, regex, REG_EXTENDED | eflags);
if (rc != 0) {
size_t len = regerror(rc, preg, NULL, 0);

Просмотреть файл

@ -899,7 +899,8 @@ void do_find_bracket(void)
char ch_under_cursor, wanted_ch;
const char *pos, *brackets = "([{<>}])";
char regexp_pat[] = "[ ]";
int old_pww = placewewant, current_x_save, flagsave, count = 1;
int old_pww = placewewant, current_x_save, count = 1;
long flags_save;
filestruct *current_save;
ch_under_cursor = current->data[current_x];
@ -915,7 +916,7 @@ void do_find_bracket(void)
current_x_save = current_x;
current_save = current;
flagsave = flags;
flags_save = flags;
SET(USE_REGEXP);
/* Apparent near redundancy with regexp_pat[] here is needed.
@ -958,7 +959,7 @@ void do_find_bracket(void)
}
regexp_cleanup();
flags = flagsave;
flags = flags_save;
}
#endif