aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Barenblat <bbaren@google.com>2019-09-19 10:34:32 -0400
committerBenjamin Barenblat <bbaren@google.com>2019-09-19 10:34:32 -0400
commitf80b980d4a8893836ba5bc108ecf9068676f4f6a (patch)
tree8fea618bdc38cef52abc621ec7f4da0eb7e6e6f2
parent7920a7438ccca47c801abd536e6c358786a1b261 (diff)
s/realloc2/xrealloc/g
`xrealloc` is the canonical name for a realloc function that fails instead of returning NULL.
-rw-r--r--walk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/walk.c b/walk.c
index 05b3aa7..d984002 100644
--- a/walk.c
+++ b/walk.c
@@ -41,7 +41,7 @@ static struct dirent *readdir2(DIR *const dirp)
}
// Like realloc(3), but exits the binary in an out-of-memory situation.
-static void *realloc2(void *ptr, const size_t size)
+static void *xrealloc(void *ptr, const size_t size)
{
if (!(ptr = realloc(ptr, size))) {
perror("realloc");
@@ -74,7 +74,7 @@ static int walk(const char dirname[])
if (strcmp(f->d_name, ".") == 0
|| strcmp(f->d_name, "..") == 0)
continue;
- filename = realloc2(filename,
+ filename = xrealloc(filename,
strlen(dirname) + 1 + strlen(f->d_name) + 1);
strcpy3(filename, dirname, "/", f->d_name);
// TODO(bbaren@google.com): Emulate Plan 9's cleanname(3).