chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unit: reduce heap usage for unit objects
[elogind.git]
/
src
/
mount.c
diff --git
a/src/mount.c
b/src/mount.c
index 12c0710f1fb9d9cfd2de84957dd389946c79358c..f94c0eb278dbe10f12fc83d5c9563761f1d63438 100644
(file)
--- a/
src/mount.c
+++ b/
src/mount.c
@@
-1395,13
+1395,16
@@
static int mount_add_one(
if (!is_path(where))
return 0;
if (!is_path(where))
return 0;
- if (!(e = unit_name_from_path(where, ".mount")))
+ e = unit_name_from_path(where, ".mount");
+ if (!e)
return -ENOMEM;
return -ENOMEM;
- if (!(u = manager_get_unit(m, e))) {
+ u = manager_get_unit(m, e);
+ if (!u) {
delete = true;
delete = true;
- if (!(u = unit_new(m))) {
+ u = unit_new(m, sizeof(Mount));
+ if (!u) {
free(e);
return -ENOMEM;
}
free(e);
return -ENOMEM;
}
@@
-1412,7
+1415,8
@@
static int mount_add_one(
if (r < 0)
goto fail;
if (r < 0)
goto fail;
- if (!(MOUNT(u)->where = strdup(where))) {
+ MOUNT(u)->where = strdup(where);
+ if (!MOUNT(u)->where) {
r = -ENOMEM;
goto fail;
}
r = -ENOMEM;
goto fail;
}
@@
-1837,6
+1841,7
@@
DEFINE_STRING_TABLE_LOOKUP(mount_exec_command, MountExecCommand);
const UnitVTable mount_vtable = {
.suffix = ".mount",
const UnitVTable mount_vtable = {
.suffix = ".mount",
+ .object_size = sizeof(Mount),
.sections =
"Unit\0"
"Mount\0"
.sections =
"Unit\0"
"Mount\0"