gallium/tgsi/text: Replace open-coded integer parsing with parse_int().
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 20 Mar 2012 21:46:11 +0000 (22:46 +0100)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 11 May 2012 10:39:43 +0000 (12:39 +0200)
src/gallium/auxiliary/tgsi/tgsi_text.c

index c38adeb931c12caaa581c07e7e8fcf981769380e..279a046e202c6d6d8b2b132abc49157477a21d11 100644 (file)
@@ -466,24 +466,10 @@ parse_register_bracket(
          eat_opt_white(&ctx->cur);
       }
 
-      if (*ctx->cur == '+' || *ctx->cur == '-') {
-         boolean negate;
-
-         negate = *ctx->cur == '-';
-         ctx->cur++;
-         eat_opt_white( &ctx->cur );
-         if (!parse_uint( &ctx->cur, &uindex )) {
-            report_error( ctx, "Expected literal unsigned integer" );
-            return FALSE;
-         }
-         if (negate)
-            brackets->index = -(int) uindex;
-         else
-            brackets->index = (int) uindex;
-      }
-      else {
+      if (*ctx->cur == '+' || *ctx->cur == '-')
+         parse_int( &ctx->cur, &brackets->index );
+      else
          brackets->index = 0;
-      }
    }
    else {
       if (!parse_uint( &ctx->cur, &uindex )) {