Remove '\0' from output. Fix a compiler warning.

Don't output '\0' in "@@FINISHED\0".

Cast code to unsigned int.  This helps platforms with 16-bit int, by
doing only the low 16 bits of the bitwise-and.  It also removes the
"(warning) conversion of long to pointer loses accuracy".
This commit is contained in:
George Koehler 2017-12-18 21:17:42 -05:00
parent ad47fa5fe3
commit a4e6595032

View file

@ -5,7 +5,7 @@
void finished(void) void finished(void)
{ {
static const char s[] = "@@FINISHED\n"; static const char s[] = "@@FINISHED\n";
write(1, s, sizeof(s)); write(1, s, sizeof(s)-1);
_exit(0); _exit(0);
} }
@ -16,7 +16,7 @@ void writehex(uint32_t code)
do do
{ {
*--p = "0123456789abcdef"[code & 0xf]; *--p = "0123456789abcdef"[(unsigned int)code & 0xf];
code >>= 4; code >>= 4;
} }
while (code > 0); while (code > 0);