text stringlengths 0 14.1k |
|---|
stackNumber++; |
} |
else |
{ |
stackString = (char *)malloc((strlen(startStackString) + 1) * sizeof(char)); |
if (startStackString != NULL) |
{ |
strcpy(stackString, startStackString); |
} |
} |
} |
void TIGStringEndStack(const char *endStackString) |
{ |
if (endStackString != NULL) |
{ |
while (theStringStack != NULL) |
{ |
TIGValue *theNextStack = theStringStack->nextStack; |
// 0 means both strings are the same |
if (strcmp(theStringStack->stackString, endStackString) == 0) |
{ |
theStringStack = TIGStringDestroy(theStringStack); |
} |
theStringStack = theNextStack; |
} |
} |
else |
{ |
while (theNumberStack != NULL) |
{ |
TIGValue *theNextStack = theNumberStack->nextStack; |
if (theNumberStack->stackNumber == stackNumber) |
{ |
theNumberStack = TIGStringDestroy(theNumberStack); |
} |
theNumberStack = theNextStack; |
} |
} |
// If there is another end or start stack string called before this end stack free it |
if (stackString != NULL) |
{ |
free(stackString); |
stackString = NULL; |
} |
if (endStackString == NULL) |
{ |
stackNumber--; |
} |
} |
TIGValue *TIGStringCreate(TIGValue *tigString, TIGBool useStack) |
{ |
tigString = (TIGValue *)malloc(1 * sizeof(TIGValue)); |
if (tigString == NULL) |
{ |
#ifdef TIG_DEBUG |
printf(""ERROR Function:TIGStringCreate() Variable:tigString Equals:NULL\n""); |
#ifdef TIG_DEBUG_ASSERT |
assert(0); |
#endif |
#endif |
return NULL; |
} |
if (useStack) |
{ |
if (stackString != NULL) |
{ |
if (theStringStack == NULL) |
{ |
tigString->nextStack = NULL; |
} |
// Add the last added TIGString to the new tigString's ->nextStack |
else |
{ |
tigString->nextStack = theStringStack; |
} |
tigString->stackNumber = -1; |
tigString->stackString = (char *)malloc((strlen(stackString) + 1) * sizeof(char)); |
if (tigString->stackString != NULL) |
{ |
strcpy(tigString->stackString, stackString); |
} |
else |
{ |
#ifdef TIG_DEBUG |
printf(""ERROR Function:TIGStringCreate() Variable:tigString->stackString Equals:NULL\n""); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.