1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 20:29:34 +00:00

test/ref/otccex: Fix ramdomly occurring segfault.

The variables named tab and p are used in the context of pointers
and thus must be declared as such.  Determining the purpose they
serve, using char over int seems more feasible here as well.
This commit is contained in:
Björn Esser 2019-06-09 17:46:31 +02:00 committed by Oliver Schmidt
parent 83e0c70de5
commit 9faca05e6a

View File

@ -58,7 +58,7 @@ long fact(n)
/* Well, we could use printf, but it would be too easy */
print_num(long n,int b)
{
int tab, p, c;
char *tab, *p, c;
/* Numbers can be entered in decimal, hexadecimal ('0x' prefix) and
octal ('0' prefix) */
/* more complex programs use malloc */
@ -71,7 +71,7 @@ print_num(long n,int b)
c = c + 'a' - 10;
else
c = c + '0';
*(char *)p = c;
*p = c;
p++;
n = n / b;
/* 'break' is supported */