mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +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) {
|
||||
assert(errors != nullptr);
|
||||
if (amt > 0) {
|
||||
size_t i, max = errors->size();
|
||||
for (i = 0; i < max; i++) {
|
||||
parse_error_t *error = &errors->at(i);
|
||||
if (amt > 0 && errors != nullptr) {
|
||||
for (parse_error_t &error : *errors) {
|
||||
// Preserve the special meaning of -1 as 'unknown'.
|
||||
if (error->source_start != SOURCE_LOCATION_UNKNOWN) {
|
||||
error->source_start += amt;
|
||||
if (error.source_start != SOURCE_LOCATION_UNKNOWN) {
|
||||
error.source_start += amt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue