goughdump: use StdioFile

This commit is contained in:
Justin Viiret 2017-06-29 12:54:26 +10:00 committed by Matthew Barr
parent 11408d0ce3
commit a16a6f48b0

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2016, Intel Corporation * Copyright (c) 2015-2017, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -353,22 +353,14 @@ void nfaExecGough16_dumpText(const struct NFA *nfa, FILE *f) {
void nfaExecGough16_dump(const NFA *nfa, const string &base) { void nfaExecGough16_dump(const NFA *nfa, const string &base) {
assert(nfa->type == GOUGH_NFA_16); assert(nfa->type == GOUGH_NFA_16);
FILE *f = fopen_or_throw((base + ".txt").c_str(), "w"); nfaExecGough16_dumpText(nfa, StdioFile(base + ".txt", "w"));
nfaExecGough16_dumpText(nfa, f); nfaExecGough16_dumpDot(nfa, StdioFile(base + ".dot", "w"));
fclose(f);
f = fopen_or_throw((base + ".dot").c_str(), "w");
nfaExecGough16_dumpDot(nfa, f);
fclose(f);
} }
void nfaExecGough8_dump(const NFA *nfa, const string &base) { void nfaExecGough8_dump(const NFA *nfa, const string &base) {
assert(nfa->type == GOUGH_NFA_8); assert(nfa->type == GOUGH_NFA_8);
FILE *f = fopen_or_throw((base + ".txt").c_str(), "w"); nfaExecGough8_dumpText(nfa, StdioFile(base + ".txt", "w"));
nfaExecGough8_dumpText(nfa, f); nfaExecGough8_dumpDot(nfa, StdioFile(base + ".dot", "w"));
fclose(f);
f = fopen_or_throw((base + ".dot").c_str(), "w");
nfaExecGough8_dumpDot(nfa, f);
fclose(f);
} }
} // namespace ue2 } // namespace ue2