commit ca6281e82145f63b951ed877da6c7828903d8ff2
parent 77826c2b06442caf48cb5a3aa5c1c1cdc0585fd7
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 5 Nov 2018 09:38:07 +0100
tweaks: condense a handful of comments, and drop an assert
Diffstat:
4 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -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) {
diff --git a/src/global.c b/src/global.c
@@ -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
diff --git a/src/prompt.c b/src/prompt.c
@@ -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);
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -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;