+static void uci_load_history_file(struct uci_context *ctx, struct uci_package *p, char *filename, FILE **f, bool flush)
+{
+ FILE *stream = NULL;
+
+ UCI_TRAP_SAVE(ctx, done);
+ stream = uci_open_stream(ctx, filename, SEEK_SET, flush, false);
+ if (p)
+ uci_parse_history(ctx, stream, p);
+ UCI_TRAP_RESTORE(ctx);
+done:
+ if (f)
+ *f = stream;
+ else if (stream)
+ uci_close_stream(stream);
+}
+