1
1

tweaks: condense a handful of comments, and drop an assert

Этот коммит содержится в:
Benno Schulenberg 2018-11-05 09:38:07 +01:00
родитель 77826c2b06
Коммит ca6281e821
4 изменённых файлов: 7 добавлений и 14 удалений

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

@ -1900,13 +1900,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
while (fileptr != NULL) {
size_t data_len = strlen(fileptr->data), size;
/* Convert newlines to nulls, just before we write to disk. */
/* Decode LFs as the NULs that they are, before writing to disk. */
sunder(fileptr->data);
size = fwrite(fileptr->data, sizeof(char), data_len, f);
/* Convert nulls to newlines. data_len is the string's real
* length. */
/* Re-encode any embedded NULs as LFs. */
unsunder(fileptr->data, data_len);
if (size < data_len) {

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

@ -125,8 +125,7 @@ openfilestruct *firstfile = NULL;
#ifndef NANO_TINY
char *matchbrackets = NULL;
/* The opening and closing brackets that can be found by bracket
* searches. */
/* The opening and closing brackets that bracket searches can find. */
char *whitespace = NULL;
/* The characters used when visibly showing tabs and spaces. */
int whitespace_len[2];
@ -464,8 +463,6 @@ void assign_keyinfo(sc *s, const char *keystring, const int keycode)
s->keystr = keystring;
s->meta = (keystring[0] == 'M' && keycode == 0);
assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2));
if (keycode)
s->keycode = keycode;
else

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

@ -446,8 +446,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
char *history = NULL;
/* The current history string. */
char *magichistory = NULL;
/* The temporary string typed at the bottom of the history, if
* any. */
/* The (partial) answer that was typed at the prompt, if any. */
#ifdef ENABLE_TABCOMP
int last_kbinput = ERR;
/* The key we pressed before the current key. */
@ -534,9 +533,8 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
typing_x = strlen(answer);
}
/* If, after scrolling down, we're at the bottom of the
* history list, answer is blank, and magichistory is set,
* save magichistory in answer. */
/* If we've reached the bottom of the history list, and answer
* is blank, and magichistory is set, restore the old answer. */
if ((*history_list)->next == NULL &&
*answer == '\0' && magichistory != NULL) {
answer = mallocstrcpy(answer, magichistory);

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

@ -926,8 +926,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
while (isblank((unsigned char)*ptr))
ptr++;
/* If we have a blank line or a comment, skip to the next
* line. */
/* If the line is empty or a comment, skip to next line. */
if (*ptr == '\0' || *ptr == '#')
continue;