From f80b980d4a8893836ba5bc108ecf9068676f4f6a Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Thu, 19 Sep 2019 10:34:32 -0400 Subject: s/realloc2/xrealloc/g `xrealloc` is the canonical name for a realloc function that fails instead of returning NULL. --- walk.c | 4 ++-- 1 file 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). -- cgit v1.2.3