diff options
author | saturneric <[email protected]> | 2024-02-29 10:15:57 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-02-29 10:15:57 +0000 |
commit | c1f5b3336836e15d193582e9b8f3e044f7d8bc1b (patch) | |
tree | 35e9edb2e8f0c80dbafb76cc05ad6fe92c2c11d0 /src/module/sdk/Basic.cpp | |
parent | feat: upgrade module system (diff) | |
download | GpgFrontend-c1f5b3336836e15d193582e9b8f3e044f7d8bc1b.tar.gz GpgFrontend-c1f5b3336836e15d193582e9b8f3e044f7d8bc1b.zip |
feat: add module controller and continue to work on module system
1. speed up building by reducing build info sheader including
2. add module controller
3. continue to work on module system
Diffstat (limited to 'src/module/sdk/Basic.cpp')
-rw-r--r-- | src/module/sdk/Basic.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/module/sdk/Basic.cpp b/src/module/sdk/Basic.cpp index 35ce8054..ce222fbd 100644 --- a/src/module/sdk/Basic.cpp +++ b/src/module/sdk/Basic.cpp @@ -57,12 +57,16 @@ void ExecuteCommandSync(const char* cmd, int32_t argc, const char** argv, void ExecuteCommandBatchSync(int32_t context_size, const CommandExecuteContext* context) { QList<GpgFrontend::GpgCommandExecutor::ExecuteContext> contexts; + for (int i = 0; i < context_size; i++) { - auto exec_context = context[i]; + const auto& exec_context = context[i]; + QStringList args; - for (int i = 0; i < exec_context.argc; i++) { - args.append(QString::fromUtf8(exec_context.argv[i])); + const char** argv = exec_context.argv; + for (int j = 0; j < exec_context.argc; j++) { + args.append(QString::fromUtf8(argv[j])); } + contexts.append( {exec_context.cmd, args, [data = exec_context.data, cb = exec_context.cb]( @@ -72,4 +76,14 @@ void ExecuteCommandBatchSync(int32_t context_size, } GpgFrontend::GpgCommandExecutor::ExecuteConcurrentlySync(contexts); +} + +auto GPGFRONTEND_MODULE_SDK_EXPORT GFModuleStrDup(const char* src) -> char* { + auto len = strlen(src); + + char* dst = static_cast<char*>(AllocateMemory((len + 1) * sizeof(char))); + memcpy(dst, src, len); + dst[len] = '\0'; + + return dst; }
\ No newline at end of file |