Skip to content

Commit

Permalink
fts: reallocarr() use reallocarray()
Browse files Browse the repository at this point in the history
This uses reallocarray(3)[1] to implement reallocarr(3)[2].

[1]: https://man.freebsd.org/cgi/man.cgi?query=reallocarray
[2]: https://man.netbsd.org/reallocarr.3
  • Loading branch information
gportay committed Nov 26, 2024
1 parent 7110130 commit 0955716
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions fts.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ int reallocarr(void *ptr, size_t m, size_t n)
if (!ptr)
return EINVAL;

if (n && m > -1 / n)
return ENOMEM;

p = realloc(ptr, m * n);
p = reallocarray(ptr, m, n);
if (!p)
return errno;

Expand Down

0 comments on commit 0955716

Please sign in to comment.