printf: no need to nul-terminate after strndup
This commit is contained in:
parent
096da1297b
commit
c5a51123b1
2
printf.c
2
printf.c
|
@ -62,7 +62,6 @@ main(int argc, char *argv[])
|
||||||
for (; strchr("+-0123456789", format[i]); i++);
|
for (; strchr("+-0123456789", format[i]); i++);
|
||||||
if (j != i) {
|
if (j != i) {
|
||||||
tmp = estrndup(format + j, i - j);
|
tmp = estrndup(format + j, i - j);
|
||||||
tmp[i - j] = 0;
|
|
||||||
width = estrtonum(tmp, 0, INT_MAX);
|
width = estrtonum(tmp, 0, INT_MAX);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -84,7 +83,6 @@ main(int argc, char *argv[])
|
||||||
for (; strchr("+-0123456789", format[i]); i++);
|
for (; strchr("+-0123456789", format[i]); i++);
|
||||||
if (j != i) {
|
if (j != i) {
|
||||||
tmp = estrndup(format + j, i - j);
|
tmp = estrndup(format + j, i - j);
|
||||||
tmp[i - j] = 0;
|
|
||||||
precision = estrtonum(tmp, 0, INT_MAX);
|
precision = estrtonum(tmp, 0, INT_MAX);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user