tweaks: condense a handful of comments, and drop an assert
parent
77826c2b06
commit
ca6281e821
|
@ -1900,13 +1900,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||||
while (fileptr != NULL) {
|
while (fileptr != NULL) {
|
||||||
size_t data_len = strlen(fileptr->data), size;
|
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);
|
sunder(fileptr->data);
|
||||||
|
|
||||||
size = fwrite(fileptr->data, sizeof(char), data_len, f);
|
size = fwrite(fileptr->data, sizeof(char), data_len, f);
|
||||||
|
|
||||||
/* Convert nulls to newlines. data_len is the string's real
|
/* Re-encode any embedded NULs as LFs. */
|
||||||
* length. */
|
|
||||||
unsunder(fileptr->data, data_len);
|
unsunder(fileptr->data, data_len);
|
||||||
|
|
||||||
if (size < data_len) {
|
if (size < data_len) {
|
||||||
|
|
|
@ -125,8 +125,7 @@ openfilestruct *firstfile = NULL;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
char *matchbrackets = NULL;
|
char *matchbrackets = NULL;
|
||||||
/* The opening and closing brackets that can be found by bracket
|
/* The opening and closing brackets that bracket searches can find. */
|
||||||
* searches. */
|
|
||||||
char *whitespace = NULL;
|
char *whitespace = NULL;
|
||||||
/* The characters used when visibly showing tabs and spaces. */
|
/* The characters used when visibly showing tabs and spaces. */
|
||||||
int whitespace_len[2];
|
int whitespace_len[2];
|
||||||
|
@ -464,8 +463,6 @@ void assign_keyinfo(sc *s, const char *keystring, const int keycode)
|
||||||
s->keystr = keystring;
|
s->keystr = keystring;
|
||||||
s->meta = (keystring[0] == 'M' && keycode == 0);
|
s->meta = (keystring[0] == 'M' && keycode == 0);
|
||||||
|
|
||||||
assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2));
|
|
||||||
|
|
||||||
if (keycode)
|
if (keycode)
|
||||||
s->keycode = keycode;
|
s->keycode = keycode;
|
||||||
else
|
else
|
||||||
|
|
|
@ -446,8 +446,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||||
char *history = NULL;
|
char *history = NULL;
|
||||||
/* The current history string. */
|
/* The current history string. */
|
||||||
char *magichistory = NULL;
|
char *magichistory = NULL;
|
||||||
/* The temporary string typed at the bottom of the history, if
|
/* The (partial) answer that was typed at the prompt, if any. */
|
||||||
* any. */
|
|
||||||
#ifdef ENABLE_TABCOMP
|
#ifdef ENABLE_TABCOMP
|
||||||
int last_kbinput = ERR;
|
int last_kbinput = ERR;
|
||||||
/* The key we pressed before the current key. */
|
/* 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);
|
typing_x = strlen(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If, after scrolling down, we're at the bottom of the
|
/* If we've reached the bottom of the history list, and answer
|
||||||
* history list, answer is blank, and magichistory is set,
|
* is blank, and magichistory is set, restore the old answer. */
|
||||||
* save magichistory in answer. */
|
|
||||||
if ((*history_list)->next == NULL &&
|
if ((*history_list)->next == NULL &&
|
||||||
*answer == '\0' && magichistory != NULL) {
|
*answer == '\0' && magichistory != NULL) {
|
||||||
answer = mallocstrcpy(answer, magichistory);
|
answer = mallocstrcpy(answer, magichistory);
|
||||||
|
|
|
@ -926,8 +926,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||||
while (isblank((unsigned char)*ptr))
|
while (isblank((unsigned char)*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
/* If we have a blank line or a comment, skip to the next
|
/* If the line is empty or a comment, skip to next line. */
|
||||||
* line. */
|
|
||||||
if (*ptr == '\0' || *ptr == '#')
|
if (*ptr == '\0' || *ptr == '#')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue