]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
mcsheng_dump: use StdioFile
authorJustin Viiret <justin.viiret@intel.com>
Thu, 29 Jun 2017 03:07:39 +0000 (13:07 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 21 Aug 2017 01:12:16 +0000 (11:12 +1000)
src/nfa/mcsheng_dump.cpp

index f5c058afb93a64b5ec42f165d2cd760aefc969f5..2b56307999d84dfc88224f3ffb64343988f63242 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Intel Corporation
+ * Copyright (c) 2016-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -394,22 +394,14 @@ void dump_text_8(const NFA *nfa, FILE *f) {
 
 void nfaExecMcSheng16_dump(const NFA *nfa, const string &base) {
     assert(nfa->type == MCSHENG_NFA_16);
-    FILE *f = fopen_or_throw((base + ".txt").c_str(), "w");
-    dump_text_16(nfa, f);
-    fclose(f);
-    f = fopen_or_throw((base + ".dot").c_str(), "w");
-    dump_dot_16(nfa, f);
-    fclose(f);
+    dump_text_16(nfa, StdioFile(base + ".txt", "w"));
+    dump_dot_16(nfa, StdioFile(base + ".dot", "w"));
 }
 
 void nfaExecMcSheng8_dump(const NFA *nfa, const string &base) {
     assert(nfa->type == MCSHENG_NFA_8);
-    FILE *f = fopen_or_throw((base + ".txt").c_str(), "w");
-    dump_text_8(nfa, f);
-    fclose(f);
-    f = fopen_or_throw((base + ".dot").c_str(), "w");
-    dump_dot_8(nfa, f);
-    fclose(f);
+    dump_text_8(nfa, StdioFile(base + ".txt", "w"));
+    dump_dot_8(nfa, StdioFile(base + ".dot", "w"));
 }
 
 } // namespace ue2