mojoshader_compiler.c
changeset 1060 4cdf5a3ceb03
parent 1028 74e7ee46ac93
child 1111 7530b37979b8
--- a/mojoshader_compiler.c	Thu Oct 20 12:08:12 2011 -0400
+++ b/mojoshader_compiler.c	Thu Oct 20 17:50:27 2011 -0400
@@ -382,7 +382,7 @@
             if (!buffer_append(ctx->garbage, &userdt, sizeof (userdt)))
             {
                 Free(ctx, userdt);
-                userdt = NULL;
+                return;
             } // if
 
             userdt->type = MOJOSHADER_AST_DATATYPE_USER;
@@ -1888,8 +1888,9 @@
                                         const MOJOSHADER_astDataType **params,
                                         const int intrinsic)
 {
-    assert( ((paramcount == 0) && (params == NULL)) ||
-            ((paramcount > 0) && (params != NULL)) );
+    if ( ((paramcount > 0) && (params == NULL)) ||
+         ((paramcount == 0) && (params != NULL)) )
+        return NULL;
 
     // !!! FIXME: this is hacky.
     const MOJOSHADER_astDataType **dtparams;
@@ -2834,7 +2835,6 @@
             } // if
 
             MOJOSHADER_astArguments *arg = ast->callfunc.args;
-            MOJOSHADER_astArguments *prev = NULL;
             int i;
             for (i = 0; i < reduced->function.num_params; i++)
             {
@@ -2847,7 +2847,6 @@
                 datatype2 = arg->argument->datatype;  // already type-checked.
                 add_type_coercion(ctx, NULL, reduced->function.params[i],
                                   &arg->argument, datatype2);
-                prev = arg;
                 arg = arg->next;
             } // for
 
@@ -5251,13 +5250,10 @@
         if (prev == NULL)
             prev = retval = item;
         else
-        {
             prev->next = item;
-            item = prev;
-        } // else
 
         args = args->next;
-    } // for
+    } // while
 
     return retval;
 } // build_ir_exprlist