Created
November 23, 2014 02:11
-
-
Save kalineh/da2b96eaa48047c6e2d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// grab all the relevant constants | |
const int bufferSize = 256; | |
const int numParams = a_thread->GetNumParams(); | |
// split single-line declarations | |
int len = 0; | |
int size = 0; | |
int ret = -1; | |
// might as well zero-init the buffer | |
char* str = NULL; | |
char buffer[bufferSize] = { 0 }; | |
// used multiple times | |
gmMachine* machine = a_thread->GetMachine(); | |
// canonical loop, no suprises | |
for (int i = 0; i < numParams; ++i) | |
{ | |
// collect block-local values used | |
gmVariable param = a_thread->Param(i); | |
const char* param_str = param.AsString(machine, buffer, bufferSize); | |
// use block-local values | |
gmConcat(machine, str, len, size, param_str, 64); | |
// fine | |
if (str) | |
{ | |
GM_ASSERT(len < size); | |
str[len++] = ' '; | |
str[len] = '\0'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment