From 9ec7d7ae90d8a221f22695378ce966734b84dda5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 3 Apr 2025 05:48:59 +0900 Subject: [PATCH] tree-wide: replace unsigned int -> unsigned, long int -> long --- src/basic/memfd-util.c | 2 +- src/basic/nss-util.h | 6 +++--- src/basic/parse-util.c | 2 +- src/basic/parse-util.h | 16 ++++++++-------- src/core/bpf/restrict_fs/restrict-fs.bpf.c | 2 +- src/core/execute-serialize.c | 2 +- .../bpf/userns_restrict/userns-restrict.bpf.c | 2 +- src/nsresourced/nsresourced-manager.c | 6 +++--- src/nsresourced/userns-restrict.c | 2 +- src/nss-systemd/nss-systemd.c | 2 +- src/nss-systemd/userdb-glue.c | 12 ++++++------ src/shared/firewall-util-nft.c | 10 +++++----- src/shared/firewall-util.h | 2 +- src/shared/openssl-util.c | 4 ++-- src/shared/qrcode-util.c | 2 +- src/test/test-log.c | 2 +- src/udev/udev-builtin-input_id.c | 2 +- 17 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/basic/memfd-util.c b/src/basic/memfd-util.c index 2e1125b867f..f2ddd4dd963 100644 --- a/src/basic/memfd-util.c +++ b/src/basic/memfd-util.c @@ -97,7 +97,7 @@ int memfd_set_sealed(int fd) { } int memfd_get_sealed(int fd) { - unsigned int seals; + unsigned seals; int r; r = memfd_get_seals(fd, &seals); diff --git a/src/basic/nss-util.h b/src/basic/nss-util.h index 579e2c0bded..2f55b7bc749 100644 --- a/src/basic/nss-util.h +++ b/src/basic/nss-util.h @@ -201,10 +201,10 @@ enum nss_status _nss_##module##_getsgent_r( \ enum nss_status _nss_##module##_initgroups_dyn( \ const char *user, \ gid_t group, \ - long int *start, \ - long int *size, \ + long *start, \ + long *size, \ gid_t **groupsp, \ - long int limit, \ + long limit, \ int *errnop) _public_; typedef enum nss_status (*_nss_gethostbyname4_r_t)( diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c index 2869a51aaa8..e3cc8451b69 100644 --- a/src/basic/parse-util.c +++ b/src/basic/parse-util.c @@ -528,7 +528,7 @@ int safe_atollu_full(const char *s, unsigned base, unsigned long long *ret_llu) return 0; } -int safe_atolli(const char *s, long long int *ret_lli) { +int safe_atolli(const char *s, long long *ret_lli) { unsigned base = 0; char *x = NULL; long long l; diff --git a/src/basic/parse-util.h b/src/basic/parse-util.h index a47c8c7935b..0af407b335b 100644 --- a/src/basic/parse-util.h +++ b/src/basic/parse-util.h @@ -41,7 +41,7 @@ static inline int safe_atou(const char *s, unsigned *ret_u) { int safe_atou_bounded(const char *s, unsigned min, unsigned max, unsigned *ret); int safe_atoi(const char *s, int *ret_i); -int safe_atolli(const char *s, long long int *ret_i); +int safe_atolli(const char *s, long long *ret_i); int safe_atou8_full(const char *s, unsigned base, uint8_t *ret); @@ -87,8 +87,8 @@ static inline int safe_atou64(const char *s, uint64_t *ret_u) { } static inline int safe_atoi64(const char *s, int64_t *ret_i) { - assert_cc(sizeof(int64_t) == sizeof(long long int)); - return safe_atolli(s, (long long int*) ret_i); + assert_cc(sizeof(int64_t) == sizeof(long long)); + return safe_atolli(s, (long long*) ret_i); } static inline int safe_atoux64(const char *s, uint64_t *ret) { @@ -101,8 +101,8 @@ static inline int safe_atolu_full(const char *s, unsigned base, unsigned long *r assert_cc(sizeof(unsigned long) == sizeof(unsigned)); return safe_atou_full(s, base, (unsigned*) ret_u); } -static inline int safe_atoli(const char *s, long int *ret_u) { - assert_cc(sizeof(long int) == sizeof(int)); +static inline int safe_atoli(const char *s, long *ret_u) { + assert_cc(sizeof(long) == sizeof(int)); return safe_atoi(s, (int*) ret_u); } #else @@ -110,9 +110,9 @@ static inline int safe_atolu_full(const char *s, unsigned base, unsigned long *r assert_cc(sizeof(unsigned long) == sizeof(unsigned long long)); return safe_atollu_full(s, base, (unsigned long long*) ret_u); } -static inline int safe_atoli(const char *s, long int *ret_u) { - assert_cc(sizeof(long int) == sizeof(long long int)); - return safe_atolli(s, (long long int*) ret_u); +static inline int safe_atoli(const char *s, long *ret_u) { + assert_cc(sizeof(long) == sizeof(long long)); + return safe_atolli(s, (long long*) ret_u); } #endif diff --git a/src/core/bpf/restrict_fs/restrict-fs.bpf.c b/src/core/bpf/restrict_fs/restrict-fs.bpf.c index eb5ed3e7fec..28fd555d5ff 100644 --- a/src/core/bpf/restrict_fs/restrict-fs.bpf.c +++ b/src/core/bpf/restrict_fs/restrict-fs.bpf.c @@ -16,7 +16,7 @@ #include struct super_block { - unsigned long int s_magic; + unsigned long s_magic; } __attribute__((preserve_access_index)); struct inode { diff --git a/src/core/execute-serialize.c b/src/core/execute-serialize.c index 220b4be5caf..2a9c619f2c2 100644 --- a/src/core/execute-serialize.c +++ b/src/core/execute-serialize.c @@ -3493,7 +3493,7 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) { if (r < 0) return r; } else if ((val = startswith(l, "exec-context-syscall-archs="))) { - unsigned int id; + unsigned id; r = safe_atou(val, &id); if (r < 0) diff --git a/src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c b/src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c index 0ff41a138be..8d75339b4bc 100644 --- a/src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c +++ b/src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c @@ -141,7 +141,7 @@ int BPF_PROG(userns_restrict_path_mkdir, struct path *dir, struct dentry *dentry } SEC("lsm/path_mknod") -int BPF_PROG(userns_restrict_path_mknod, const struct path *dir, struct dentry *dentry, umode_t mode, unsigned int dev, int ret) { +int BPF_PROG(userns_restrict_path_mknod, const struct path *dir, struct dentry *dentry, umode_t mode, unsigned dev, int ret) { return validate_path(dir, ret); } diff --git a/src/nsresourced/nsresourced-manager.c b/src/nsresourced/nsresourced-manager.c index 99a6e1fedec..b5e4376723a 100644 --- a/src/nsresourced/nsresourced-manager.c +++ b/src/nsresourced/nsresourced-manager.c @@ -521,15 +521,15 @@ static int ringbuf_event(void *userdata, void *data, size_t size) { Manager *m = ASSERT_PTR(userdata); size_t n; - if ((size % sizeof(unsigned int)) != 0) /* Not multiples of "unsigned int"? */ + if ((size % sizeof(unsigned)) != 0) /* Not multiples of "unsigned"? */ return -EIO; - n = size / sizeof(unsigned int); + n = size / sizeof(unsigned); for (size_t i = 0; i < n; i++) { const void *d; uint64_t inode; - d = (const uint8_t*) data + i * sizeof(unsigned int); + d = (const uint8_t*) data + i * sizeof(unsigned); inode = unaligned_read_ne32(d); log_debug("Got BPF ring buffer notification that user namespace %" PRIu64 " is now dead.", inode); diff --git a/src/nsresourced/userns-restrict.c b/src/nsresourced/userns-restrict.c index f23526c55f4..cd53463b74f 100644 --- a/src/nsresourced/userns-restrict.c +++ b/src/nsresourced/userns-restrict.c @@ -101,7 +101,7 @@ int userns_restrict_install( if (r < 0) return log_error_errno(r, "Failed to size userns/mnt_id hash table: %m"); - r = sym_bpf_map__set_max_entries(obj->maps.userns_ringbuf, USERNS_MAX * sizeof(unsigned int)); + r = sym_bpf_map__set_max_entries(obj->maps.userns_ringbuf, USERNS_MAX * sizeof(unsigned)); if (r < 0) return log_error_errno(r, "Failed to size userns ring buffer: %m"); diff --git a/src/nss-systemd/nss-systemd.c b/src/nss-systemd/nss-systemd.c index 0dfafa15634..b7a71d7bb14 100644 --- a/src/nss-systemd/nss-systemd.c +++ b/src/nss-systemd/nss-systemd.c @@ -965,7 +965,7 @@ enum nss_status _nss_systemd_initgroups_dyn( long *start, long *size, gid_t **groupsp, - long int limit, + long limit, int *errnop) { _cleanup_(userdb_iterator_freep) UserDBIterator *iterator = NULL; diff --git a/src/nss-systemd/userdb-glue.c b/src/nss-systemd/userdb-glue.c index 4f96e9b90f2..110235bb4ae 100644 --- a/src/nss-systemd/userdb-glue.c +++ b/src/nss-systemd/userdb-glue.c @@ -156,14 +156,14 @@ int nss_pack_user_record_shadow( .sp_namp = buffer, .sp_lstchg = hr->last_password_change_usec == 0 ? 1 : /* map 0 to 1, since 0 means please change password on next login */ hr->last_password_change_usec == UINT64_MAX ? -1 : - (long int) (hr->last_password_change_usec / USEC_PER_DAY), - .sp_min = hr->password_change_min_usec != UINT64_MAX ? (long int) (hr->password_change_min_usec / USEC_PER_DAY) : -1, - .sp_max = hr->password_change_max_usec != UINT64_MAX ? (long int) (hr->password_change_max_usec / USEC_PER_DAY) : -1, - .sp_warn = hr->password_change_warn_usec != UINT64_MAX ? (long int) (hr->password_change_warn_usec / USEC_PER_DAY) : -1, - .sp_inact = hr->password_change_inactive_usec != UINT64_MAX ? (long int) (hr->password_change_inactive_usec / USEC_PER_DAY) : -1, + (long) (hr->last_password_change_usec / USEC_PER_DAY), + .sp_min = hr->password_change_min_usec != UINT64_MAX ? (long) (hr->password_change_min_usec / USEC_PER_DAY) : -1, + .sp_max = hr->password_change_max_usec != UINT64_MAX ? (long) (hr->password_change_max_usec / USEC_PER_DAY) : -1, + .sp_warn = hr->password_change_warn_usec != UINT64_MAX ? (long) (hr->password_change_warn_usec / USEC_PER_DAY) : -1, + .sp_inact = hr->password_change_inactive_usec != UINT64_MAX ? (long) (hr->password_change_inactive_usec / USEC_PER_DAY) : -1, .sp_expire = hr->locked > 0 || hr->not_after_usec == 0 ? 1 : /* already expired/locked */ hr->not_after_usec == UINT64_MAX ? -1 : - (long int) (hr->not_after_usec / USEC_PER_DAY), + (long) (hr->not_after_usec / USEC_PER_DAY), .sp_flag = ULONG_MAX, }; diff --git a/src/shared/firewall-util-nft.c b/src/shared/firewall-util-nft.c index 07a5c2c8540..01bc43632bf 100644 --- a/src/shared/firewall-util-nft.c +++ b/src/shared/firewall-util-nft.c @@ -857,10 +857,10 @@ void fw_nftables_exit(FirewallContext *ctx) { static int nft_message_append_setelem_iprange( sd_netlink_message *m, const union in_addr_union *source, - unsigned int prefixlen) { + unsigned prefixlen) { uint32_t mask, start, end; - unsigned int nplen; + unsigned nplen; int r; assert(m); @@ -896,7 +896,7 @@ static int nft_message_append_setelem_iprange( static int nft_message_append_setelem_ip6range( sd_netlink_message *m, const union in_addr_union *source, - unsigned int prefixlen) { + unsigned prefixlen) { union in_addr_union start, end; int r; @@ -931,7 +931,7 @@ int nft_set_element_modify_iprange( const char *table, const char *set, const union in_addr_union *source, - unsigned int source_prefixlen) { + unsigned source_prefixlen) { _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL; int r; @@ -1041,7 +1041,7 @@ int fw_nftables_add_masquerade( bool add, int af, const union in_addr_union *source, - unsigned int source_prefixlen) { + unsigned source_prefixlen) { int r; diff --git a/src/shared/firewall-util.h b/src/shared/firewall-util.h index 5b3fda8732a..2c79ab40817 100644 --- a/src/shared/firewall-util.h +++ b/src/shared/firewall-util.h @@ -74,7 +74,7 @@ int nft_set_element_modify_iprange( const char *table, const char *set, const union in_addr_union *source, - unsigned int source_prefixlen); + unsigned source_prefixlen); int nft_set_element_modify_ip( FirewallContext *ctx, diff --git a/src/shared/openssl-util.c b/src/shared/openssl-util.c index b19c18e56ed..96de0708761 100644 --- a/src/shared/openssl-util.c +++ b/src/shared/openssl-util.c @@ -164,7 +164,7 @@ int openssl_digest_many( if (!buf) return log_oom_debug(); - unsigned int size; + unsigned size; if (!EVP_DigestFinal_ex(ctx, buf, &size)) return log_openssl_errors("Failed to finalize Digest"); @@ -260,7 +260,7 @@ int openssl_hmac_many( size_t size; if (!EVP_MAC_final(ctx, buf, &size, digest_size)) #else - unsigned int size; + unsigned size; if (!HMAC_Final(ctx, buf, &size)) #endif return log_openssl_errors("Failed to finalize HMAC"); diff --git a/src/shared/qrcode-util.c b/src/shared/qrcode-util.c index aac0b3886be..ff93a25a97e 100644 --- a/src/shared/qrcode-util.c +++ b/src/shared/qrcode-util.c @@ -82,7 +82,7 @@ static void print_border(FILE *output, unsigned width, unsigned row, unsigned co } } -static void write_qrcode(FILE *output, QRcode *qr, unsigned int row, unsigned int column) { +static void write_qrcode(FILE *output, QRcode *qr, unsigned row, unsigned column) { assert(qr); if (!output) diff --git a/src/test/test-log.c b/src/test/test-log.c index b36e0fcd966..b973ba94274 100644 --- a/src/test/test-log.c +++ b/src/test/test-log.c @@ -66,7 +66,7 @@ static void test_log_struct(void) { log_struct(LOG_INFO, LOG_MESSAGE("Foobar PID="PID_FMT, getpid_cached()), LOG_ITEM("FORMAT_STR_TEST=1=%i A=%c 2=%hi 3=%li 4=%lli 1=%p foo=%s 2.5=%g 3.5=%g 4.5=%Lg", - (int) 1, 'A', (short) 2, (long int) 3, (long long int) 4, (void*) 1, "foo", (float) 2.5f, (double) 3.5, (long double) 4.5), + (int) 1, 'A', (short) 2, (long) 3, (long long) 4, (void*) 1, "foo", (float) 2.5f, (double) 3.5, (long double) 4.5), LOG_ITEM("SUFFIX=GOT IT")); } diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c index f16ca00e139..60fc95e0d27 100644 --- a/src/udev/udev-builtin-input_id.c +++ b/src/udev/udev-builtin-input_id.c @@ -288,7 +288,7 @@ static bool test_pointers( * libinput uses similar heuristics, any changes here should be added to libinput too. */ if (is_joystick) { - static const unsigned int well_known_keyboard_keys[] = { + static const unsigned well_known_keyboard_keys[] = { KEY_LEFTCTRL, KEY_CAPSLOCK, KEY_NUMLOCK, KEY_INSERT, KEY_MUTE, KEY_CALC, KEY_FILE, KEY_MAIL, KEY_PLAYPAUSE, KEY_BRIGHTNESSDOWN, -- 2.47.3