basic/terminal-util: simplify output param handling

Those static functions were written to support optional output params, but they
are only ever called with the output param set, and it doesn't make sense to
ever call them without the output param. Since those are internal functions,
drop this unused complexity.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-05-16 15:33:50 +02:00
parent 5b5545f112
commit f4bdf373c5
+9 -17
View File
@@ -1970,7 +1970,8 @@ static int scan_background_color_response(
size_t *ret_processed) {
assert(context);
assert(buf || size == 0);
assert(buf);
assert(ret_processed);
for (size_t i = 0; i < size; i++) {
char c = buf[i];
@@ -2044,9 +2045,7 @@ static int scan_background_color_response(
case BACKGROUND_BLUE:
if (c == '\x07') {
if (context->blue_bits > 0) {
if (ret_processed)
*ret_processed = i + 1;
*ret_processed = i + 1;
return 1; /* success! */
}
@@ -2066,9 +2065,7 @@ static int scan_background_color_response(
case BACKGROUND_STRING_TERMINATOR:
if (c == '\\') {
if (ret_processed)
*ret_processed = i + 1;
*ret_processed = i + 1;
return 1; /* success! */
}
@@ -2085,9 +2082,7 @@ static int scan_background_color_response(
}
}
if (ret_processed)
*ret_processed = size;
*ret_processed = size;
return 0; /* all good, but not enough data yet */
}
@@ -2214,7 +2209,8 @@ static int scan_cursor_position_response(
size_t *ret_processed) {
assert(context);
assert(buf || size == 0);
assert(buf);
assert(ret_processed);
for (size_t i = 0; i < size; i++) {
char c = buf[i];
@@ -2247,9 +2243,7 @@ static int scan_cursor_position_response(
case CURSOR_COLUMN:
if (c == 'R') {
if (context->column > 0) {
if (ret_processed)
*ret_processed = i + 1;
*ret_processed = i + 1;
return 1; /* success! */
}
@@ -2272,9 +2266,7 @@ static int scan_cursor_position_response(
context->row = context->column = 0;
}
if (ret_processed)
*ret_processed = size;
*ret_processed = size;
return 0; /* all good, but not enough data yet */
}