Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Commit

Permalink
Remove testing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
drakeee committed Jan 31, 2021
1 parent 0ae0a25 commit 591d598
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/Defs/CLuaNativeDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,6 @@ T* CreatePtr(T value, alt::INative::Type argType, size_t additionalSize = 1)
return ptr;
}

static char* SaveString(const char* str)
{
static char* stringValues[256] = { 0 };
static int nextString = 0;

if (stringValues[nextString])
free(stringValues[nextString]);

char* _str = _strdup(str);
stringValues[nextString] = _str;
nextString = (nextString + 1) % 256;

return _str;
}

void PushArg(alt::Ref<alt::INative::Context> ctx, alt::INative::Type argType, alt::MValueConst &value)
{
switch (argType)
Expand Down Expand Up @@ -110,11 +95,7 @@ void PushArg(alt::Ref<alt::INative::Context> ctx, alt::INative::Type argType, al
break;
case alt::INative::Type::ARG_STRING:
{
//ctx->Push(SaveString(value.As<alt::IMValueString>()->Value().ToString().data()));
//auto stringPtr = *CreatePtr(_strdup(value.As<alt::IMValueString>()->Value().ToString().data()), argType);
auto stringPtr = SaveString(value.As<alt::IMValueString>()->Value().CStr());
ctx->Push(stringPtr);

ctx->Push(*CreatePtr(_strdup(value.As<alt::IMValueString>()->Value().ToString().data()), argType));
break;
}
case alt::INative::Type::ARG_STRUCT:
Expand Down

0 comments on commit 591d598

Please sign in to comment.