tweaks: elide an unneeded/duplicate variable

This commit is contained in:
Benno Schulenberg 2018-08-04 11:34:44 +02:00
parent bb90de0eb4
commit e90b7cf4aa
4 changed files with 6 additions and 10 deletions

View File

@ -78,9 +78,7 @@ int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
#endif #endif
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
ssize_t fill = 0; ssize_t fill = -COLUMNS_FROM_EOL;
/* The column where we will wrap lines. */
ssize_t wrap_at = -COLUMNS_FROM_EOL;
/* The column where we will wrap lines. */ /* The column where we will wrap lines. */
#endif #endif

View File

@ -718,7 +718,6 @@ void window_init(void)
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
/* Set up the wrapping point, accounting for screen width when negative. */ /* Set up the wrapping point, accounting for screen width when negative. */
fill = wrap_at;
if (fill <= 0) if (fill <= 0)
fill += COLS; fill += COLS;
if (fill < 0) if (fill < 0)
@ -2246,7 +2245,7 @@ int main(int argc, char **argv)
#endif #endif
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
case 'r': case 'r':
if (!parse_num(optarg, &wrap_at)) { if (!parse_num(optarg, &fill)) {
fprintf(stderr, _("Requested fill size \"%s\" is invalid"), optarg); fprintf(stderr, _("Requested fill size \"%s\" is invalid"), optarg);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
exit(1); exit(1);
@ -2334,7 +2333,7 @@ int main(int argc, char **argv)
char *operating_dir_cpy = operating_dir; char *operating_dir_cpy = operating_dir;
#endif #endif
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
ssize_t wrap_at_cpy = wrap_at; ssize_t fill_cpy = fill;
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
char *backup_dir_cpy = backup_dir; char *backup_dir_cpy = backup_dir;
@ -2382,7 +2381,7 @@ int main(int argc, char **argv)
#endif #endif
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
if (fill_used) if (fill_used)
wrap_at = wrap_at_cpy; fill = fill_cpy;
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
if (backup_dir_cpy != NULL) { if (backup_dir_cpy != NULL) {

View File

@ -81,7 +81,6 @@ extern int shiftaltdown;
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
extern ssize_t fill; extern ssize_t fill;
extern ssize_t wrap_at;
#endif #endif
extern char *last_search; extern char *last_search;

View File

@ -1102,10 +1102,10 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
#endif #endif
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
if (strcasecmp(rcopts[i].name, "fill") == 0) { if (strcasecmp(rcopts[i].name, "fill") == 0) {
if (!parse_num(option, &wrap_at)) { if (!parse_num(option, &fill)) {
rcfile_error(N_("Requested fill size \"%s\" is invalid"), rcfile_error(N_("Requested fill size \"%s\" is invalid"),
option); option);
wrap_at = -COLUMNS_FROM_EOL; fill = -COLUMNS_FROM_EOL;
} else } else
UNSET(NO_WRAP); UNSET(NO_WRAP);
free(option); free(option);