From f6dd0ad18ab932e12466417d0d2f703aaa547ae6 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 2 Aug 2016 17:26:25 +0200 Subject: [PATCH] tweaks: compile a parameter unconditionally Straightforward code is more important than the tiniest possible binary. Also adjust some comments and rename a variable. --- src/nano.c | 29 ++++++++--------------------- src/nano.h | 4 ++-- src/proto.h | 6 +----- 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/nano.c b/src/nano.c index 7cbc403e..0ba102ad 100644 --- a/src/nano.c +++ b/src/nano.c @@ -609,53 +609,40 @@ void die(const char *msg, ...) delete_lockfile(openfile->lock_filename); #endif - /* Save the current file buffer if it's been modified. */ + /* If the current file buffer was modified, save it. */ if (openfile && openfile->modified) { - /* If we've partitioned the filestruct, unpartition it now. */ + /* If the filestruct is partitioned, unpartition it first. */ if (filepart != NULL) unpartition_filestruct(&filepart); - die_save_file(openfile->filename -#ifndef NANO_TINY - , openfile->current_stat -#endif - ); + die_save_file(openfile->filename, openfile->current_stat); } #ifndef DISABLE_MULTIBUFFER /* Save all of the other modified file buffers, if any. */ if (openfile != NULL) { - openfilestruct *tmp = openfile; + openfilestruct *firstone = openfile; - while (tmp != openfile->next) { + while (openfile->next != firstone) { openfile = openfile->next; #ifndef NANO_TINY if (ISSET(LOCKING) && openfile->lock_filename) delete_lockfile(openfile->lock_filename); #endif - /* Save the current file buffer if it's been modified. */ if (openfile->modified) - die_save_file(openfile->filename -#ifndef NANO_TINY - , openfile->current_stat -#endif - ); + die_save_file(openfile->filename, openfile->current_stat); } } #endif - /* Get out. */ + /* Abandon the building. */ exit(1); } /* Save the current file under the name specified in die_filename, which * is modified to be unique if necessary. */ -void die_save_file(const char *die_filename -#ifndef NANO_TINY - , struct stat *die_stat -#endif - ) +void die_save_file(const char *die_filename, struct stat *die_stat) { char *targetname; bool failed = TRUE; diff --git a/src/nano.h b/src/nano.h index 7f5ec758..08996499 100644 --- a/src/nano.h +++ b/src/nano.h @@ -393,6 +393,8 @@ typedef struct openfilestruct { /* The file's y-coordinate position. */ bool modified; /* Whether the file has been modified. */ + struct stat *current_stat; + /* The file's current stat information. */ #ifndef NANO_TINY bool mark_set; /* Whether the mark is on in this file. */ @@ -402,8 +404,6 @@ typedef struct openfilestruct { /* The file's mark's x-coordinate position, if any. */ file_format fmt; /* The file's format. */ - struct stat *current_stat; - /* The file's current stat information. */ undo *undotop; /* The top of the undo list. */ undo *current_undo; diff --git a/src/proto.h b/src/proto.h index eaa424c4..d7ae25d8 100644 --- a/src/proto.h +++ b/src/proto.h @@ -442,11 +442,7 @@ void say_there_is_no_help(void); #endif void finish(void); void die(const char *msg, ...); -void die_save_file(const char *die_filename -#ifndef NANO_TINY - , struct stat *die_stat -#endif - ); +void die_save_file(const char *die_filename, struct stat *die_stat); void window_init(void); #ifndef DISABLE_MOUSE void disable_mouse_support(void);