Skip to content

Commit

Permalink
Fixed stupid linked list bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 3, 2009
1 parent 4e8ab34 commit 8095057
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 8 additions & 7 deletions mojoshader.c
Expand Up @@ -396,19 +396,20 @@ static void failf(Context *ctx, const char *fmt, ...)
error->error.error = failstr;
error->error.filename = NULL; // no filename at this level.
error->error.error_position = error_position;
error->next = NULL;

ErrorList *prev = NULL;
error->next = ctx->errors;
while (error->next != NULL)
ErrorList *item = ctx->errors;
while (item != NULL)
{
prev = error->next;
error->next = error->next->next;
prev = item;
item = error->next;
} // while

if (prev != NULL)
prev->next = error;
else
if (prev == NULL)
ctx->errors = error;
else
prev->next = error;

ctx->error_count++;
} // else
Expand Down
15 changes: 8 additions & 7 deletions mojoshader_assembler.c
Expand Up @@ -145,19 +145,20 @@ static void failf(Context *ctx, const char *fmt, ...)
error->error.error = failstr;
error->error.filename = fname ? StrDup(ctx, fname) : NULL;
error->error.error_position = error_position;
error->next = NULL;

ErrorList *prev = NULL;
error->next = ctx->errors;
while (error->next != NULL)
ErrorList *item = ctx->errors;
while (item != NULL)
{
prev = error->next;
error->next = error->next->next;
prev = item;
item = error->next;
} // while

if (prev != NULL)
prev->next = error;
else
if (prev == NULL)
ctx->errors = error;
else
prev->next = error;

ctx->error_count++;
} // else
Expand Down

0 comments on commit 8095057

Please sign in to comment.