Wow guys, that was pseudocode -- not actual code (I thought this was clear when I said "In a nutshell" and considering it made no sense and would never compile as actual code.) I didn't want to post the actual code because it is too complicated for the problem I *was* having.
Thanks for the help, though. I'll try to never post problems I am having at 3am+ ever again.
For the hell of it, here's the actual code I was struggling with last night (this morning):
Code:
void big_construct(char big[], char* str)
{
unsigned int l, c, s = 0, b = 3;
if (str && (l = strlen(str)))
{
big_begin(str, big);
while (1)
{
if ((c = chars_left(l, s)) >= 2)
{
big_insert(str, big, &s, &b, c = (c >= 3) ? 2 : 1);
b += 3*c;
s += c;
continue;
}
else
{
big_finish(str, big, s, b);
break;
}
}
}
else *big = NULL;
}
static void big_insert(char* str, char big[], unsigned int* s, unsigned int* b, unsigned int c)
{
while (c--)
{
if (!big_contains(*(str + *s), *(str + *s + 1), big))
{
big[*b++] = *(str + *s++);
big[*b++] = *(str + *s);
big[*b++] = ':';
}
else
{
*s += 2;
break;
}
}
}