summaryrefslogtreecommitdiff
path: root/python/generator.cpp
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2023-05-31 17:16:41 -0400
committerKyleMiles <krm504@nyu.edu>2023-05-31 17:16:41 -0400
commitb46e2e19c3a840e8e110f0b768efc73add56c33f (patch)
tree5a57db166c77be0ed9403d98d2c2edb3451974af /python/generator.cpp
parent348815b2ee562110063c512634d3543bd3ad80b6 (diff)
Simplify template simplifier API; remove cursed RustString stuff
Diffstat (limited to 'python/generator.cpp')
-rw-r--r--python/generator.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/python/generator.cpp b/python/generator.cpp
index 9f5e24eb..fb9c3567 100644
--- a/python/generator.cpp
+++ b/python/generator.cpp
@@ -437,12 +437,9 @@ int main(int argc, char* argv[])
// From python -> C python3 requires str -> str.encode('charmap')
bool swizzleArgs = true;
- if (name == "BNFreeString" || name == "BNRustFreeString")
+ if (name == "BNFreeString")
swizzleArgs = false;
- // Rust-allocated strings are deallocated differently
- bool rustFFI = name.rfind("BNRust", 0) == 0;
-
bool callbackConvention = false;
if (name == "BNAllocString")
{
@@ -467,7 +464,7 @@ int main(int argc, char* argv[])
for (auto& j : i.second->GetParameters())
{
fprintf(out, "\t\t");
- if (name == "BNFreeString" || name == "BNRustFreeString")
+ if (name == "BNFreeString")
{
// BNFreeString expects a pointer to a string allocated by the core, so do not use
// a c_char_p here, as that would be allocated by the Python runtime. This can
@@ -568,10 +565,7 @@ int main(int argc, char* argv[])
fprintf(out, "\tresult = ");
fprintf(out, "%s\n", stringArgFuncCall.c_str());
fprintf(out, "\tstring = str(pyNativeStr(ctypes.cast(result, ctypes.c_char_p).value))\n");
- if (rustFFI)
- fprintf(out, "\tBNRustFreeString(result)\n");
- else
- fprintf(out, "\tBNFreeString(result)\n");
+ fprintf(out, "\tBNFreeString(result)\n");
fprintf(out, "\treturn string\n");
}
else if (pointerResult)