We built the list of matches in reverse order (compared to what Augeas
itself gives us). So we have to reverse the list after building it so
they are in the normal order.
if (r == -1)
raise_error (t, "Augeas.matches");
- /* Copy the paths to a list. */
+ /* Copy the paths to a list.
+ * This builds the list in reverse order, but we call List.rev later.
+ */
rv = Val_int (0);
for (i = 0; i < r; ++i) {
v = caml_copy_string (matches[i]);
= "ocaml_augeas_label"
external rm : t -> path -> int
= "ocaml_augeas_rm"
-external matches : t -> path -> path list
+external matches' : t -> path -> path list
= "ocaml_augeas_match"
+let matches aug path = List.rev (matches' aug path)
external count_matches : t -> path -> int
= "ocaml_augeas_count_matches"
external save : t -> unit