[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fixits: sort them before applying them
From: |
Akim Demaille |
Subject: |
fixits: sort them before applying them |
Date: |
Wed, 8 May 2019 14:32:40 +0200 |
commit 7aa38561f71d44dac3697324dd2d19cce74f9170
Author: Akim Demaille <address@hidden>
Date: Sat May 4 17:52:51 2019 +0200
fixits: sort them before applying them
An experimental commit introduced a fix-it hint that changes comments
such as "/* empty */" into %empty. But in some case, because
diagnostics are not necessarily emitted in order, the fixits also come
in disorder, which must never happen, as the fixes are installed in
one pass.
* src/fixits.c (fixits_register): Insert them in order.
diff --git a/src/fixits.c b/src/fixits.c
index 3a8bf481..97c50569 100644
--- a/src/fixits.c
+++ b/src/fixits.c
@@ -52,6 +52,11 @@ fixit_new (location const *loc, char const* fix)
return res;
}
+static int
+fixit_cmp (const fixit *a, const fixit *b)
+{
+ return location_cmp (a->location, b->location);
+}
static void
fixit_free (fixit *f)
@@ -85,7 +90,7 @@ fixits_register (location const *loc, char const* fix)
(gl_listelement_dispose_fn) fixit_free,
true);
fixit *f = fixit_new (loc, fix);
- gl_list_add_last (fixits, f);
+ gl_sortedlist_add (fixits, (gl_listelement_compar_fn) fixit_cmp, f);
if (feature_flag & feature_fixit_parsable)
fixit_print (f, stderr);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- fixits: sort them before applying them,
Akim Demaille <=