From aa5582c434ee4b3e25536dc77b673b9b04acfc79 Mon Sep 17 00:00:00 2001 From: scawful Date: Thu, 8 Aug 2024 13:46:50 -0400 Subject: [PATCH] rename Extension to yaze_extension for global namespace --- src/ext/extension.cc | 11 ++++++----- src/ext/extension.h | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ext/extension.cc b/src/ext/extension.cc index 327796bf..9e58ed83 100644 --- a/src/ext/extension.cc +++ b/src/ext/extension.cc @@ -6,9 +6,9 @@ #include void* handle = nullptr; -Extension* extension = nullptr; +yaze_extension* extension = nullptr; -Extension* GetExtension() { return nullptr; } +yaze_extension* GetExtension() { return nullptr; } void LoadCExtension(const char* extensionPath) { handle = dlopen(extensionPath, RTLD_LAZY); @@ -18,8 +18,8 @@ void LoadCExtension(const char* extensionPath) { } dlerror(); // Clear any existing error - Extension* (*getExtension)(); - getExtension = (Extension * (*)()) dlsym(handle, "getExtension"); + yaze_extension* (*getExtension)(); + getExtension = (yaze_extension * (*)()) dlsym(handle, "getExtension"); const char* dlsym_error = dlerror(); if (dlsym_error) { std::cerr << "Cannot load symbol 'getExtension': " << dlsym_error @@ -47,7 +47,8 @@ void LoadPythonExtension(const char* script_path) { PyObject* pExtension = PyObject_CallObject(pFunc, nullptr); if (pExtension) { // Assume the Python extension has the same structure as the C extension - extension = reinterpret_cast(PyLong_AsVoidPtr(pExtension)); + extension = + reinterpret_cast(PyLong_AsVoidPtr(pExtension)); } } } \ No newline at end of file diff --git a/src/ext/extension.h b/src/ext/extension.h index 69581d16..00afdffe 100644 --- a/src/ext/extension.h +++ b/src/ext/extension.h @@ -5,7 +5,7 @@ extern "C" { #endif -typedef struct Extension { +typedef struct yaze_extension { const char* name; const char* version; @@ -17,10 +17,10 @@ typedef struct Extension { // Function to extend editor functionality void (*extendFunctionality)(void* editorContext); -} Extension; +} yaze_extension; // Function to get the extension instance -Extension* GetExtension(); +yaze_extension* GetExtension(); void LoadCExtension(const char* extension_path);