tweaks: compile a parameter unconditionally

Straightforward code is more important than the tiniest possible binary.

Also adjust some comments and rename a variable.
master
Benno Schulenberg 2016-08-02 17:26:25 +02:00
parent a7ae1766c0
commit f6dd0ad18a
3 changed files with 11 additions and 28 deletions

View File

@ -609,53 +609,40 @@ void die(const char *msg, ...)
delete_lockfile(openfile->lock_filename); delete_lockfile(openfile->lock_filename);
#endif #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 (openfile && openfile->modified) {
/* If we've partitioned the filestruct, unpartition it now. */ /* If the filestruct is partitioned, unpartition it first. */
if (filepart != NULL) if (filepart != NULL)
unpartition_filestruct(&filepart); unpartition_filestruct(&filepart);
die_save_file(openfile->filename die_save_file(openfile->filename, openfile->current_stat);
#ifndef NANO_TINY
, openfile->current_stat
#endif
);
} }
#ifndef DISABLE_MULTIBUFFER #ifndef DISABLE_MULTIBUFFER
/* Save all of the other modified file buffers, if any. */ /* Save all of the other modified file buffers, if any. */
if (openfile != NULL) { if (openfile != NULL) {
openfilestruct *tmp = openfile; openfilestruct *firstone = openfile;
while (tmp != openfile->next) { while (openfile->next != firstone) {
openfile = openfile->next; openfile = openfile->next;
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(LOCKING) && openfile->lock_filename) if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename); delete_lockfile(openfile->lock_filename);
#endif #endif
/* Save the current file buffer if it's been modified. */
if (openfile->modified) if (openfile->modified)
die_save_file(openfile->filename die_save_file(openfile->filename, openfile->current_stat);
#ifndef NANO_TINY
, openfile->current_stat
#endif
);
} }
} }
#endif #endif
/* Get out. */ /* Abandon the building. */
exit(1); exit(1);
} }
/* Save the current file under the name specified in die_filename, which /* Save the current file under the name specified in die_filename, which
* is modified to be unique if necessary. */ * is modified to be unique if necessary. */
void die_save_file(const char *die_filename void die_save_file(const char *die_filename, struct stat *die_stat)
#ifndef NANO_TINY
, struct stat *die_stat
#endif
)
{ {
char *targetname; char *targetname;
bool failed = TRUE; bool failed = TRUE;

View File

@ -393,6 +393,8 @@ typedef struct openfilestruct {
/* The file's y-coordinate position. */ /* The file's y-coordinate position. */
bool modified; bool modified;
/* Whether the file has been modified. */ /* Whether the file has been modified. */
struct stat *current_stat;
/* The file's current stat information. */
#ifndef NANO_TINY #ifndef NANO_TINY
bool mark_set; bool mark_set;
/* Whether the mark is on in this file. */ /* 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. */ /* The file's mark's x-coordinate position, if any. */
file_format fmt; file_format fmt;
/* The file's format. */ /* The file's format. */
struct stat *current_stat;
/* The file's current stat information. */
undo *undotop; undo *undotop;
/* The top of the undo list. */ /* The top of the undo list. */
undo *current_undo; undo *current_undo;

View File

@ -442,11 +442,7 @@ void say_there_is_no_help(void);
#endif #endif
void finish(void); void finish(void);
void die(const char *msg, ...); void die(const char *msg, ...);
void die_save_file(const char *die_filename void die_save_file(const char *die_filename, struct stat *die_stat);
#ifndef NANO_TINY
, struct stat *die_stat
#endif
);
void window_init(void); void window_init(void);
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
void disable_mouse_support(void); void disable_mouse_support(void);