summaryrefslogtreecommitdiffstats
path: root/src/portable/portable.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-10-08 08:26:02 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-10-08 12:56:09 +0200
commit223a67e572918e6176cf10dfea86331e89bc6226 (patch)
treeb7f83794111d18d1be53cd1b5e27b7df3eea7c00 /src/portable/portable.c
parentsd-bus: introduce bus_process_cmsg() (diff)
downloadsystemd-223a67e572918e6176cf10dfea86331e89bc6226.tar.xz
systemd-223a67e572918e6176cf10dfea86331e89bc6226.zip
tree-wide: replace reallocarray() with GREEDY_REALLOC()
Diffstat (limited to 'src/portable/portable.c')
-rw-r--r--src/portable/portable.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/portable/portable.c b/src/portable/portable.c
index b1055aa8c3..5476a86614 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -904,7 +904,6 @@ static int portable_changes_add(
const char *source) {
_cleanup_free_ char *p = NULL, *s = NULL;
- PortableChange *c;
int r;
assert(path);
@@ -918,10 +917,8 @@ static int portable_changes_add(
if (!changes)
return 0;
- c = reallocarray(*changes, *n_changes + 1, sizeof(PortableChange));
- if (!c)
+ if (!GREEDY_REALLOC(*changes, *n_changes + 1))
return -ENOMEM;
- *changes = c;
r = path_simplify_alloc(path, &p);
if (r < 0)
@@ -931,7 +928,7 @@ static int portable_changes_add(
if (r < 0)
return r;
- c[(*n_changes)++] = (PortableChange) {
+ (*changes)[(*n_changes)++] = (PortableChange) {
.type_or_errno = type_or_errno,
.path = TAKE_PTR(p),
.source = TAKE_PTR(s),