From: Timothy Arceri Date: Sat, 2 Apr 2016 10:07:50 +0000 (+1100) Subject: mesa: remove unrequired else X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d54096fa6cde0ebc7da29468071fe2c34aec0cf;p=mesa.git mesa: remove unrequired else The if always returns so no need for an else. Reviewed-by: Brian Paul --- diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index 02d84f20cd8..c294b005b85 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -248,54 +248,51 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList, paramList->Size = 0; return -1; } - else { - GLuint i, j; - - paramList->NumParameters = oldNum + sz4; - - memset(¶mList->Parameters[oldNum], 0, - sz4 * sizeof(struct gl_program_parameter)); - - for (i = 0; i < sz4; i++) { - struct gl_program_parameter *p = paramList->Parameters + oldNum + i; - p->Name = name ? strdup(name) : NULL; - p->Type = type; - p->Size = size; - p->DataType = datatype; - if (values) { - if (size >= 4) { - COPY_4V(paramList->ParameterValues[oldNum + i], values); + + GLuint i, j; + + paramList->NumParameters = oldNum + sz4; + + memset(¶mList->Parameters[oldNum], 0, + sz4 * sizeof(struct gl_program_parameter)); + + for (i = 0; i < sz4; i++) { + struct gl_program_parameter *p = paramList->Parameters + oldNum + i; + p->Name = name ? strdup(name) : NULL; + p->Type = type; + p->Size = size; + p->DataType = datatype; + if (values) { + if (size >= 4) { + COPY_4V(paramList->ParameterValues[oldNum + i], values); + } else { + /* copy 1, 2 or 3 values */ + GLuint remaining = size % 4; + assert(remaining < 4); + for (j = 0; j < remaining; j++) { + paramList->ParameterValues[oldNum + i][j].f = values[j].f; } - else { - /* copy 1, 2 or 3 values */ - GLuint remaining = size % 4; - assert(remaining < 4); - for (j = 0; j < remaining; j++) { - paramList->ParameterValues[oldNum + i][j].f = values[j].f; - } - /* fill in remaining positions with zeros */ - for (; j < 4; j++) { - paramList->ParameterValues[oldNum + i][j].f = 0.0f; - } + /* fill in remaining positions with zeros */ + for (; j < 4; j++) { + paramList->ParameterValues[oldNum + i][j].f = 0.0f; } - values += 4; - p->Initialized = GL_TRUE; } - else { - /* silence valgrind */ - for (j = 0; j < 4; j++) - paramList->ParameterValues[oldNum + i][j].f = 0; - } - size -= 4; - } - - if (state) { - for (i = 0; i < STATE_LENGTH; i++) - paramList->Parameters[oldNum].StateIndexes[i] = state[i]; + values += 4; + p->Initialized = GL_TRUE; + } else { + /* silence valgrind */ + for (j = 0; j < 4; j++) + paramList->ParameterValues[oldNum + i][j].f = 0; } + size -= 4; + } - return (GLint) oldNum; + if (state) { + for (i = 0; i < STATE_LENGTH; i++) + paramList->Parameters[oldNum].StateIndexes[i] = state[i]; } + + return (GLint) oldNum; }