tweaks: elide a one-line function that is used just twice
parent
597d90207e
commit
a57c6a6763
|
@ -1472,8 +1472,7 @@ void init_operating_dir(void)
|
|||
die(_("Invalid operating directory: %s\n"), operating_dir);
|
||||
|
||||
free(operating_dir);
|
||||
operating_dir = target;
|
||||
snuggly_fit(&operating_dir);
|
||||
operating_dir = charealloc(target, strlen(target) + 1);
|
||||
}
|
||||
|
||||
/* Check whether the given path is outside of the operating directory.
|
||||
|
@ -1540,8 +1539,7 @@ void init_backup_dir(void)
|
|||
die(_("Invalid backup directory: %s\n"), backup_dir);
|
||||
|
||||
free(backup_dir);
|
||||
backup_dir = target;
|
||||
snuggly_fit(&backup_dir);
|
||||
backup_dir = charealloc(target, strlen(target) + 1);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
|
|
|
@ -557,7 +557,6 @@ int digits(ssize_t n);
|
|||
#endif
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
|
||||
void snuggly_fit(char **str);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
|
|
|
@ -159,12 +159,6 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/* Reduce the memory allocation of a string to what is needed. */
|
||||
void snuggly_fit(char **string)
|
||||
{
|
||||
*string = charealloc(*string, strlen(*string) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue