Deduplicate error string patterns (#37676)

I wanted to see if moving moving out constant string arguments our of
error messages results in smaller binary sizes. Turns out it does, but
the savings are not consistent. Sometimes we get a few kB in a single
binary, sometimes there is no size change.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-06-02 15:34:17 +02:00
committed by GitHub
44 changed files with 162 additions and 150 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ static int builtin_btrfs(UdevEvent *event, int argc, char *argv[]) {
return 0;
}
return log_device_debug_errno(dev, errno, "Failed to open /dev/btrfs-control: %m");
return log_device_debug_errno(dev, errno, "Failed to open %s: %m", "/dev/btrfs-control");
}
struct btrfs_ioctl_vol_args args = {};
+2 -2
View File
@@ -415,7 +415,7 @@ static int udev_watch_clear_by_wd(sd_device *dev, int dirfd, int wd) {
if (dirfd < 0) {
dirfd_close = RET_NERRNO(open("/run/udev/watch/", O_CLOEXEC | O_DIRECTORY | O_NOFOLLOW | O_RDONLY));
if (dirfd_close < 0)
return log_device_debug_errno(dev, dirfd_close, "Failed to open '/run/udev/watch/': %m");
return log_device_debug_errno(dev, dirfd_close, "Failed to open %s: %m", "/run/udev/watch/");
dirfd = dirfd_close;
}
@@ -595,7 +595,7 @@ int manager_remove_watch(Manager *manager, sd_device *dev) {
if (dirfd == -ENOENT)
return 0;
if (dirfd < 0)
return log_device_debug_errno(dev, dirfd, "Failed to open '/run/udev/watch/': %m");
return log_device_debug_errno(dev, dirfd, "Failed to open %s: %m", "/run/udev/watch/");
/* First, clear symlinks. */
r = udev_watch_clear(dev, dirfd, &wd);