commit 75f4309c1fd8ea24c6c217d0a792e1c2e81d7b49
parent 78767b583d0726f9f820b390fbe00db893ca71f9
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 13 Feb 2020 14:20:52 +0100
tweaks: rename four parameters, to be more distinct and telling
Diffstat:
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -1635,8 +1635,8 @@ void process_a_keystroke(void)
#endif
}
-/* The user typed output_len multibyte characters. Add them to the buffer. */
-void inject(char *output, size_t output_len)
+/* Insert the given short burst of bytes into the edit buffer. */
+void inject(char *burst, size_t count)
{
size_t current_len = strlen(openfile->current->data);
size_t index = 0;
@@ -1651,12 +1651,12 @@ void inject(char *output, size_t output_len)
}
#endif
- while (index < output_len) {
+ while (index < count) {
/* Encode an embedded NUL byte as 0x0A. */
- if (output[index] == '\0')
- output[index] = '\n';
+ if (burst[index] == '\0')
+ burst[index] = '\n';
- charlen = char_length(output + index);
+ charlen = char_length(burst + index);
/* Make room for the new character and copy it into the line. */
openfile->current->data = charealloc(openfile->current->data,
@@ -1665,7 +1665,7 @@ void inject(char *output, size_t output_len)
openfile->current->data + openfile->current_x,
current_len - openfile->current_x + 1);
strncpy(openfile->current->data + openfile->current_x,
- output + index, charlen);
+ burst + index, charlen);
current_len += charlen;
index += charlen;
diff --git a/src/prompt.c b/src/prompt.c
@@ -173,23 +173,23 @@ int do_statusbar_input(bool *finished)
return input;
}
-/* The user typed input_len multibyte characters. Add them to the answer. */
-void inject_into_answer(char *output, size_t input_len)
+/* Insert the given short burst of bytes into the anwer. */
+void inject_into_answer(char *burst, size_t count)
{
size_t charlen, index = 0;
- while (index < input_len) {
+ while (index < count) {
/* Encode any NUL byte as 0x0A. */
- if (output[index] == '\0')
- output[index] = '\n';
+ if (burst[index] == '\0')
+ burst[index] = '\n';
- charlen = char_length(output + index);
+ charlen = char_length(burst + index);
/* Insert the typed character into the existing answer string. */
answer = charealloc(answer, strlen(answer) + charlen + 1);
memmove(answer + typing_x + charlen, answer + typing_x,
strlen(answer) - typing_x + 1);
- strncpy(answer + typing_x, output + index, charlen);
+ strncpy(answer + typing_x, burst + index, charlen);
typing_x += charlen;
index += charlen;
diff --git a/src/proto.h b/src/proto.h
@@ -442,10 +442,10 @@ void confirm_margin(void);
#endif
void unbound_key(int code);
bool okay_for_view(const keystruct *shortcut);
-void inject(char *output, size_t output_len);
+void inject(char *burst, size_t count);
/* Most functions in prompt.c. */
-void inject_into_answer(char *output, size_t input_len);
+void inject_into_answer(char *burst, size_t count);
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);