[Mesa-dev] [PATCH 02/14] mesa: Replace open-coded _mesa_lookup_enum_by_nr().
Eric Anholt
eric at anholt.net
Tue Feb 26 10:38:22 PST 2013
Ian Romanick <idr at freedesktop.org> writes:
> On 02/22/2013 07:52 PM, Eric Anholt wrote:
>> ---
>> src/mesa/main/errors.c | 38 +++-----------------------------------
>> 1 file changed, 3 insertions(+), 35 deletions(-)
>>
>> diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
>> index 761b555..987cddb 100644
>> --- a/src/mesa/main/errors.c
>> +++ b/src/mesa/main/errors.c
>> @@ -29,7 +29,7 @@
>>
>>
>> #include "errors.h"
>> -
>> +#include "enums.h"
>> #include "imports.h"
>> #include "context.h"
>> #include "dispatch.h"
>> @@ -836,38 +836,6 @@ output_if_debug(const char *prefixString, const char *outputString,
>> }
>> }
>>
>> -
>> -/**
>> - * Return string version of GL error code.
>> - */
>> -static const char *
>> -error_string( GLenum error )
>> -{
>> - switch (error) {
>> - case GL_NO_ERROR:
>> - return "GL_NO_ERROR";
>> - case GL_INVALID_VALUE:
>> - return "GL_INVALID_VALUE";
>> - case GL_INVALID_ENUM:
>> - return "GL_INVALID_ENUM";
>> - case GL_INVALID_OPERATION:
>> - return "GL_INVALID_OPERATION";
>> - case GL_STACK_OVERFLOW:
>> - return "GL_STACK_OVERFLOW";
>> - case GL_STACK_UNDERFLOW:
>> - return "GL_STACK_UNDERFLOW";
>> - case GL_OUT_OF_MEMORY:
>> - return "GL_OUT_OF_MEMORY";
>> - case GL_TABLE_TOO_LARGE:
>> - return "GL_TABLE_TOO_LARGE";
>> - case GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
>> - return "GL_INVALID_FRAMEBUFFER_OPERATION";
>> - default:
>> - return "unknown";
>> - }
>> -}
>> -
>> -
>> /**
>> * When a new type of error is recorded, print a message describing
>> * previous errors which were accumulated.
>> @@ -880,7 +848,7 @@ flush_delayed_errors( struct gl_context *ctx )
>> if (ctx->ErrorDebugCount) {
>> _mesa_snprintf(s, MAX_DEBUG_MESSAGE_LENGTH, "%d similar %s errors",
>> ctx->ErrorDebugCount,
>> - error_string(ctx->ErrorValue));
>> + _mesa_lookup_enum_by_nr(ctx->ErrorValue));
>
> Does _mesa_lookup_enum_by_nr do the right thing for GL_NO_ERROR?
> Several other enums alias 0, so it could get the string for one of
> those. I definitely approve of its use for all the other cases.
Good catch. No, but I don't see any caller of _mesa_error with
GL_NO_ERROR (because what would you even mean by that?), so I think
we're cool.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130226/4deaef08/attachment.pgp>
More information about the mesa-dev
mailing list