all: code format

This commit is contained in:
Íñigo Huguet
2025-05-13 11:43:33 +02:00
parent 3d1b55047b
commit bcbe386823
12 changed files with 25 additions and 29 deletions

View File

@@ -117,7 +117,7 @@ ip6_address_delete(NMPlatform *platform, int ifindex, struct in6_addr addr, guin
const int _dirfd = (dirfd); \
const char *const _path = (path); \
\
g_assert(_path &&_path[0]); \
g_assert(_path && _path[0]); \
g_assert(!strstr(_path, "/../")); \
if (_dirfd < 0) { \
g_assert(!_pathid); \

View File

@@ -255,8 +255,8 @@ _assert_expected_content(NMConnection *connection, const char *filename, const c
GError *_error = NULL; \
gboolean _success; \
\
g_assert(_ifcfg_dir &&_ifcfg_dir[0]); \
g_assert(_filename &&_filename[0]); \
g_assert(_ifcfg_dir && _ifcfg_dir[0]); \
g_assert(_filename && _filename[0]); \
\
_success = nms_ifcfg_rh_writer_write_connection(_connection, \
_ifcfg_dir, \
@@ -9533,12 +9533,10 @@ test_svUnescape(void)
.exp = v_expected, \
.can_concat = !!v_expected, \
}
#define V2(v_value, v_expected) \
{ \
.val = "" v_value "", \
.exp = v_expected, \
.can_concat = TRUE, \
.needs_ascii_separator = TRUE, \
#define V2(v_value, v_expected) \
{ \
.val = "" v_value "", .exp = v_expected, .can_concat = TRUE, \
.needs_ascii_separator = TRUE, \
}
const UnescapeTestData data_full[] = {
V1("", ""),

View File

@@ -61,7 +61,7 @@ check_ip_route(NMSettingIPConfig *config,
gs_free_error GError *_error = NULL; \
NMConnection *_connection; \
\
g_assert(full_filename &&full_filename[0] == '/'); \
g_assert(full_filename && full_filename[0] == '/'); \
\
_connection = \
nms_keyfile_reader_from_file(full_filename, \

View File

@@ -8205,7 +8205,7 @@ const NMLDBusMetaIface _nml_dbus_meta_iface_nm_settings = NML_DBUS_META_IFACE_IN
_priv.settings.connections,
nm_remote_connection_get_type,
.notify_changed_ao = _property_ao_notify_changed_connections_cb,
.check_nmobj_visible_fcn = (gboolean(*)(GObject *)) nm_remote_connection_get_visible),
.check_nmobj_visible_fcn = (gboolean (*)(GObject *)) nm_remote_connection_get_visible),
NML_DBUS_META_PROPERTY_INIT_S("Hostname",
PROP_HOSTNAME,
NMClient,

View File

@@ -1684,7 +1684,7 @@ nm_keyfile_detect_unqualified_path_scheme(const char *base_dir,
const char *const _bin = (bin); \
const gsize _bin_len = (bin_len); \
\
nm_assert(_bin &&_bin_len > 0); \
nm_assert(_bin && _bin_len > 0); \
\
(_bin_len > NM_STRLEN(scheme) + 1 && _bin[_bin_len - 1] == '\0' \
&& memcmp(_bin, scheme, NM_STRLEN(scheme)) == 0); \

View File

@@ -8680,11 +8680,9 @@ test_nm_utils_ascii_str_to_int64(void)
static void
test_nm_utils_strstrdictkey(void)
{
#define _VALUES_STATIC(_v1, _v2) \
{ \
.v1 = _v1, \
.v2 = _v2, \
.v_static = _nm_utils_strstrdictkey_static(_v1, _v2), \
#define _VALUES_STATIC(_v1, _v2) \
{ \
.v1 = _v1, .v2 = _v2, .v_static = _nm_utils_strstrdictkey_static(_v1, _v2), \
}
const struct {
const char *v1;

View File

@@ -212,10 +212,10 @@ nm_hash_update_str(NMHashState *state, const char *str)
/* Like nm_hash_update_str(), but restricted to arrays only. nm_hash_update_str() only works
* with a @str argument that cannot be NULL. If you have a string pointer, that is never NULL, use
* nm_hash_update() instead. */
#define nm_hash_update_strarr(state, str) \
(_Generic(&(str), \
const char(*)[sizeof(str)]: nm_hash_update_str((state), (str)), \
char(*)[sizeof(str)]: nm_hash_update_str((state), (str))))
#define nm_hash_update_strarr(state, str) \
(_Generic(&(str), \
const char (*)[sizeof(str)]: nm_hash_update_str((state), (str)), \
char (*)[sizeof(str)]: nm_hash_update_str((state), (str))))
#else
#define nm_hash_update_strarr(state, str) nm_hash_update_str((state), (str))
#endif
@@ -224,7 +224,7 @@ guint nm_hash_ptr(gconstpointer ptr);
#define nm_direct_hash nm_hash_ptr
guint nm_hash_str(const char *str);
#define nm_str_hash ((guint(*)(gconstpointer str)) nm_hash_str)
#define nm_str_hash ((guint (*)(gconstpointer str)) nm_hash_str)
#define nm_hash_vals(static_seed, ...) \
({ \

View File

@@ -1504,7 +1504,7 @@ _nmtst_main_loop_quit_on_notify(GObject *object, GParamSpec *pspec, gpointer use
(timeout_msec), \
(poll_msec), \
condition)) \
g_assert(FALSE &&#condition); \
g_assert(FALSE && #condition); \
} \
G_STMT_END

View File

@@ -641,7 +641,7 @@ _nm_printf(3, 4) static void _iovec_set_format(struct iovec *iov,
{ \
const char *_str_arg = (str_arg); \
\
nm_assert(_str_arg &&strlen(_str_arg) < (max_str_len)); \
nm_assert(_str_arg && strlen(_str_arg) < (max_str_len)); \
_iovec_set_format_a((iov), (max_str_len), format, str_arg); \
} \
G_STMT_END

View File

@@ -6143,7 +6143,7 @@ nla_put_failure:
const int _dirfd = (dirfd); \
const char *const _path = (path); \
\
nm_assert(_path &&_path[0]); \
nm_assert(_path && _path[0]); \
g_assert(!strstr(_path, "/../")); \
if (_dirfd < 0) { \
nm_assert(!_pathid); \
@@ -6151,7 +6151,7 @@ nla_put_failure:
nm_assert(NM_STR_HAS_PREFIX(_path, "/proc/sys/") || NM_STR_HAS_PREFIX(_path, "/sys/") \
|| NM_STR_HAS_PREFIX(_path, "/proc/net")); \
} else { \
nm_assert(_pathid &&_pathid[0] && _pathid[0] != '/'); \
nm_assert(_pathid && _pathid[0] && _pathid[0] != '/'); \
nm_assert(_path[0] != '/'); \
} \
} \

View File

@@ -2007,8 +2007,8 @@ _vt_dedup_obj_clone(const NMDedupMultiObj *obj)
.obj_destroy = _vt_dedup_obj_destroy, \
.obj_full_hash_update = \
(void (*)(const NMDedupMultiObj *obj, NMHashState *h)) nmp_object_hash_update, \
.obj_full_equal = (gboolean(*)(const NMDedupMultiObj *obj_a, \
const NMDedupMultiObj *obj_b)) nmp_object_equal, \
.obj_full_equal = (gboolean (*)(const NMDedupMultiObj *obj_a, \
const NMDedupMultiObj *obj_b)) nmp_object_equal, \
}
/*****************************************************************************/

View File

@@ -163,7 +163,7 @@ struct Request {
const ScriptInfo *const _script = (x_script); \
const Request *const _request = _script ? _script->request : NULL; \
\
nm_assert(_script &&_request); \
nm_assert(_script && _request); \
if (enabled_cmd) \
__LOG_print_S(print_cmd, _request, _script, ": "__VA_ARGS__); \
} \