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

index 484d6c14f4863d62db9adfb02e81fff4e313951f..4ed5cef0c565e3a7bba0a52ebc769c0fdad69996 100644 (file)
 #include "nfagraph/ng_dump.h"
 #include "nfagraph/ng_is_equal.h"
 #include "util/container.h"
+#include "util/dump_util.h"
 #include "ue2common.h"
 
-#include <map>
 #include <cstdio>
+#include <map>
 #include <string>
 
 #ifndef DUMP_SUPPORT
@@ -55,7 +56,6 @@ void dumpSomSlotManager(const SomSlotManager &ssm, const Grey &grey) {
         return;
     }
 
-    string filename = grey.dumpPath + "/ssm.txt";
     map<u32, const SlotCacheEntry *> by_slot;
     map<u32, const InitialResetInfo *> by_slot_ir;
 
@@ -67,7 +67,7 @@ void dumpSomSlotManager(const SomSlotManager &ssm, const Grey &grey) {
         by_slot_ir[e.slot] = &e;
     }
 
-    FILE *f = fopen(filename.c_str(), "w");
+    StdioFile f(grey.dumpPath + "/ssm.txt", "w");
 
     fprintf(f, "slot width %u bytes\n\n", ssm.precision);
 
@@ -94,8 +94,6 @@ void dumpSomSlotManager(const SomSlotManager &ssm, const Grey &grey) {
         }
     }
 
-    fclose(f);
-
     for (const auto &h : ssm.cache->initial_prefixes) {
         dumpHolder(*h, hash_holder(*h), "ssm_prefix", grey);
     }