scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 0b7c80e6d7c308b94d24d1eaf4ec0efc0938f16c
parent c2698edb9fdaada886594ef754dad5cb79de737a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 10 Sep 2014 20:57:01 +0200

Move to symbol() the trick with identifiers num

This patch allows us to have the trick only in one
place and not in all the code.

Diffstat:
Mcc2/parser.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cc2/parser.c b/cc2/parser.c @@ -81,7 +81,7 @@ static Symbol * parameter(char *num) { static Symbol *tbl; - unsigned i = atoi(num+1); + unsigned i = atoi(num); static unsigned nr; if (i >= NR_FUNPARAM) @@ -97,7 +97,7 @@ static Symbol * local(char *num) { static Symbol *tbl; - unsigned i = atoi(num+1); + unsigned i = atoi(num); static unsigned nr; if (i >= NR_INT_IDENT) @@ -113,7 +113,7 @@ static Symbol * global(char *num) { static Symbol *tbl; - unsigned i = atoi(num+1); + unsigned i = atoi(num); static unsigned nr; if (i >= NR_EXT_IDENT) @@ -184,7 +184,7 @@ symbol(uint8_t t, char *token) [GLOBAL] = global, [PARAMETER] = parameter }; - return (*tbl[t])(token); + return (*tbl[t])(token+1); } static void