gallium: list use inline function to avoid macro shot coming
[mesa.git] / src / mesa / program / prog_parameter.c
index 40dc92cb201c7341dd686f0e9c7ab7e3a63b8577..3570cab118b22cb8d2192cc21f81155292e173e9 100644 (file)
@@ -378,18 +378,9 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
 
    /* Check if the state reference is already in the list */
    for (index = 0; index < (GLint) paramList->NumParameters; index++) {
-      GLuint i, match = 0;
-      for (i = 0; i < STATE_LENGTH; i++) {
-         if (paramList->Parameters[index].StateIndexes[i] == stateTokens[i]) {
-            match++;
-         }
-         else {
-            break;
-         }
-      }
-      if (match == STATE_LENGTH) {
-         /* this state reference is already in the parameter list */
-         return index;
+      if (!memcmp(paramList->Parameters[index].StateIndexes,
+                 stateTokens, STATE_LENGTH * sizeof(gl_state_index))) {
+        return index;
       }
    }
 
@@ -482,8 +473,10 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
    assert(vSize >= 1);
    assert(vSize <= 4);
 
-   if (!list)
-      return -1;
+   if (!list) {
+      *posOut = -1;
+      return GL_FALSE;
+   }
 
    for (i = 0; i < list->NumParameters; i++) {
       if (list->Parameters[i].Type == PROGRAM_CONSTANT) {