arch: x86: avoided increments/decrements with side effects
- moved ++/-- before or after the value use Signed-off-by: frei tycho <tfrei@baumer.com>
This commit is contained in:
parent
d191c13f0d
commit
81e4b91bb5
2 changed files with 13 additions and 6 deletions
|
|
@ -45,14 +45,18 @@ static void prdec(struct _pfr *r, long v)
|
|||
char digs[11 * sizeof(long)/4];
|
||||
int i = sizeof(digs) - 1;
|
||||
|
||||
digs[i--] = 0;
|
||||
digs[i] = 0;
|
||||
--i;
|
||||
while (v || i == 9) {
|
||||
digs[i--] = '0' + (v % 10);
|
||||
digs[i] = '0' + (v % 10);
|
||||
--i;
|
||||
v /= 10;
|
||||
}
|
||||
|
||||
while (digs[++i] != '\0') {
|
||||
++i;
|
||||
while (digs[i] != '\0') {
|
||||
pc(r, digs[i]);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,8 +105,10 @@ static int vpf(struct _pfr *r, const char *f, va_list ap)
|
|||
case 's': {
|
||||
char *s = va_arg(ap, char *);
|
||||
|
||||
while (*s != '\0')
|
||||
pc(r, *s++);
|
||||
while (*s != '\0') {
|
||||
pc(r, *s);
|
||||
++s;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'p':
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ static void efi_putchar(int c)
|
|||
efi_putchar('\r');
|
||||
}
|
||||
|
||||
efibuf[n++] = c;
|
||||
efibuf[n] = c;
|
||||
++n;
|
||||
|
||||
if (c == '\n' || n == PUTCHAR_BUFSZ) {
|
||||
efibuf[n] = 0U;
|
||||
|
|
|
|||
Loading…
Reference in a new issue