Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove m_reader / m_builder members from AnalysisContext #6417

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions binaryninjaapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -9911,8 +9911,7 @@ namespace BinaryNinja {
class AnalysisContext :
public CoreRefCountObject<BNAnalysisContext, BNNewAnalysisContextReference, BNFreeAnalysisContext>
{
std::unique_ptr<Json::CharReader> m_reader;
Json::StreamWriterBuilder m_builder;
static Json::StreamWriterBuilder& JsonBuilder();

public:
AnalysisContext(BNAnalysisContext* analysisContext);
Expand Down Expand Up @@ -9996,7 +9995,7 @@ namespace BinaryNinja {
}},
arg);

return Inform(Json::writeString(m_builder, request));
return Inform(Json::writeString(JsonBuilder(), request));
}
#endif
};
Expand Down
15 changes: 12 additions & 3 deletions workflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ using namespace BinaryNinja;
using namespace std;


AnalysisContext::AnalysisContext(BNAnalysisContext* analysisContext) :
m_reader(Json::CharReaderBuilder().newCharReader())
// static
Json::StreamWriterBuilder& AnalysisContext::JsonBuilder()
{
static Json::StreamWriterBuilder* builder = [] {
auto builder = new Json::StreamWriterBuilder;
(*builder)["indentation"] = "";
return builder;
}();
return *builder;
}

AnalysisContext::AnalysisContext(BNAnalysisContext* analysisContext)
{
// LogError("API-Side AnalysisContext Constructed!");
m_object = analysisContext;
m_builder["indentation"] = "";
}


Expand Down