Fix for C89 compatibility
This commit is contained in:
parent
ba79eaf7f4
commit
60245f9da0
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
||||
all: test
|
||||
|
||||
test: test.c uprintf.c uprintf.h
|
||||
gcc -std=c99 -Os -o test test.c uprintf.c
|
||||
gcc -std=c89 -Os -o test test.c uprintf.c
|
||||
|
||||
clean:
|
||||
rm -rf test
|
||||
|
||||
@ -66,12 +66,12 @@ static int l_strlen(const char *str)
|
||||
/* Helper functions for p() */
|
||||
static void print_string(put_char_func pc, const char *str, int width, char wchr)
|
||||
{
|
||||
int sl;
|
||||
int sl, w;
|
||||
|
||||
if (width < 0)
|
||||
{
|
||||
sl = l_strlen(str);
|
||||
for (int w = -width; w > sl; w --)
|
||||
for (w = -width; w > sl; w --)
|
||||
pc(wchr);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ static void print_string(put_char_func pc, const char *str, int width, char wchr
|
||||
|
||||
if (width > 0)
|
||||
{
|
||||
for (int w = width; w > sl; w --)
|
||||
for (w = width; w > sl; w --)
|
||||
pc(wchr);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user