Skip to content

Commit

Permalink
vcscanf: remove strtod call repetition
Browse files Browse the repository at this point in the history
Place it after the GotFloatingPointNumber label where it belongs.
  • Loading branch information
matheusmoreira committed Nov 4, 2023
1 parent 64d2b12 commit 8f12a06
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions libc/stdio/vcscanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ int __vcscanf(int callback(void *), //
hexadecimal = true;
goto BufferFloatingPointNumber;
} else if (c == -1) {
fp = strtod((char *) buf, NULL);
goto GotFloatingPointNumber;
} else {
goto BufferFloatingPointNumber;
Expand All @@ -367,10 +366,8 @@ int __vcscanf(int callback(void *), //
if (c == ')') {
c = BUFFER;
}
fp = strtod((char *) buf, NULL);
goto GotFloatingPointNumber;
} else {
fp = strtod((char *) buf, NULL);
goto GotFloatingPointNumber;
}
} else {
Expand Down Expand Up @@ -411,7 +408,6 @@ int __vcscanf(int callback(void *), //
if (c != -1 && unget) {
unget(c, arg);
}
fp = strtod((char *) buf, NULL);
goto GotFloatingPointNumber;
}
} else {
Expand Down Expand Up @@ -469,8 +465,8 @@ int __vcscanf(int callback(void *), //
}
break;
} while ((c = BUFFER) != -1);
fp = strtod((char *)buf, NULL);
GotFloatingPointNumber:
fp = strtod((char *)buf, NULL);
if (!discard) {
++items;
void *out = va_arg(va, void *);
Expand Down

0 comments on commit 8f12a06

Please sign in to comment.