mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
Clean up parse_error_offset_source_start
Use range-based for loops and relax the requirement that we have an error list.
This commit is contained in:
parent
04d7d89020
commit
10362a70df
1 changed files with 4 additions and 7 deletions
|
@ -134,14 +134,11 @@ wcstring parse_error_t::describe(const wcstring &src, bool is_interactive) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_error_offset_source_start(parse_error_list_t *errors, size_t amt) {
|
void parse_error_offset_source_start(parse_error_list_t *errors, size_t amt) {
|
||||||
assert(errors != nullptr);
|
if (amt > 0 && errors != nullptr) {
|
||||||
if (amt > 0) {
|
for (parse_error_t &error : *errors) {
|
||||||
size_t i, max = errors->size();
|
|
||||||
for (i = 0; i < max; i++) {
|
|
||||||
parse_error_t *error = &errors->at(i);
|
|
||||||
// Preserve the special meaning of -1 as 'unknown'.
|
// Preserve the special meaning of -1 as 'unknown'.
|
||||||
if (error->source_start != SOURCE_LOCATION_UNKNOWN) {
|
if (error.source_start != SOURCE_LOCATION_UNKNOWN) {
|
||||||
error->source_start += amt;
|
error.source_start += amt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue