all: use NM_MAX() instead of MAX()

This commit is contained in:
Thomas Haller 2023-10-27 14:36:56 +02:00
parent b4dd83975e
commit bee14cf47c
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
18 changed files with 28 additions and 28 deletions

View file

@ -1431,7 +1431,7 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason)
mtu = nm_setting_ppp_get_mtu(s_ppp);
mru = nm_setting_ppp_get_mru(s_ppp);
mxu = MAX(mru, mtu);
mxu = NM_MAX(mru, mtu);
if (mxu) {
_LOGD(LOGD_PPP,
"set MTU to %u (PPP interface MRU %u, MTU %u)",

View file

@ -239,7 +239,7 @@ receive_ra(gpointer user_data)
priv->receive_ra_id = 0;
/* preserve the "most managed" level on updates. */
dhcp_level = MAX(rdata->public.dhcp_level, ra->dhcp_level);
dhcp_level = NM_MAX(rdata->public.dhcp_level, ra->dhcp_level);
if (rdata->public.dhcp_level != dhcp_level) {
rdata->public.dhcp_level = dhcp_level;

View file

@ -161,7 +161,7 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
* let's keep the "most managed" level. */
G_STATIC_ASSERT_EXPR(NM_NDISC_DHCP_LEVEL_MANAGED > NM_NDISC_DHCP_LEVEL_OTHERCONF);
G_STATIC_ASSERT_EXPR(NM_NDISC_DHCP_LEVEL_OTHERCONF > NM_NDISC_DHCP_LEVEL_NONE);
dhcp_level = MAX(dhcp_level, rdata->public.dhcp_level);
dhcp_level = NM_MAX(dhcp_level, rdata->public.dhcp_level);
if (dhcp_level != rdata->public.dhcp_level) {
rdata->public.dhcp_level = dhcp_level;

View file

@ -4256,8 +4256,8 @@ read_device_factory_paths_sort_fcn(gconstpointer a, gconstpointer b)
const struct plugin_info *db = b;
time_t ta, tb;
ta = MAX(da->st.st_mtime, da->st.st_ctime);
tb = MAX(db->st.st_mtime, db->st.st_ctime);
ta = NM_MAX(da->st.st_mtime, da->st.st_ctime);
tb = NM_MAX(db->st.st_mtime, db->st.st_ctime);
if (ta < tb)
return 1;

View file

@ -1766,7 +1766,7 @@ _connection_autoconnect_retries_set(NMPolicy *self,
nm_assert(retry_time != 0);
priv->reset_connections_retries_idle_source = nm_g_timeout_add_seconds_source(
MAX(0, retry_time - nm_utils_get_monotonic_timestamp_sec()),
NM_MAX(0, retry_time - nm_utils_get_monotonic_timestamp_sec()),
reset_connections_retries,
self);
}

View file

@ -1380,7 +1380,7 @@ _get_capability(NMSupplicantInterfacePrivate *priv, NMSupplCapType type)
case NM_SUPPL_CAP_TYPE_AP:
iface_value = NM_SUPPL_CAP_MASK_GET(priv->iface_capabilities, type);
value = NM_SUPPL_CAP_MASK_GET(priv->global_capabilities, type);
value = MAX(iface_value, value);
value = NM_MAX(iface_value, value);
break;
case NM_SUPPL_CAP_TYPE_FT:
value = NM_SUPPL_CAP_MASK_GET(priv->global_capabilities, type);

View file

@ -1518,7 +1518,7 @@ nm_utils_ip4_routes_to_variant(GPtrArray *routes)
array[1] = nm_ip_route_get_prefix(route);
nm_ip_route_get_next_hop_binary(route, &array[2]);
/* The old routes format uses "0" for default, not "-1" */
array[3] = MAX(0, nm_ip_route_get_metric(route));
array[3] = NM_MAX(0, nm_ip_route_get_metric(route));
g_variant_builder_add(&builder, "@au", nm_g_variant_new_au(array, 4));
}

View file

@ -181,8 +181,8 @@ _sort_files(LoadDirInfo *a, LoadDirInfo *b)
{
time_t ta, tb;
ta = MAX(a->stat.st_mtime, a->stat.st_ctime);
tb = MAX(b->stat.st_mtime, b->stat.st_ctime);
ta = NM_MAX(a->stat.st_mtime, a->stat.st_ctime);
tb = NM_MAX(b->stat.st_mtime, b->stat.st_ctime);
if (ta < tb)
return 1;
if (ta > tb)

View file

@ -6962,10 +6962,10 @@ _poll_done_cb(GObject *source, GAsyncResult *result, gpointer user_data)
else
wait_ms = 0;
if (poll_task_data->sleep_timeout_ms > 0)
wait_ms = MAX(wait_ms, poll_task_data->sleep_timeout_ms);
wait_ms = NM_MAX(wait_ms, poll_task_data->sleep_timeout_ms);
poll_task_data->source_next_poll =
nm_g_source_attach(nm_g_timeout_source_new(MAX(1, wait_ms),
nm_g_source_attach(nm_g_timeout_source_new(NM_MAX(1, wait_ms),
G_PRIORITY_DEFAULT,
_poll_start_cb,
poll_task_data,

View file

@ -8651,7 +8651,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->ifindex,
nm_platform_ip4_route_get_n_nexthops(obj),
obj->gateway,
(guint8) MAX(obj->weight, 1u));
(guint8) NM_MAX(obj->weight, 1u));
}
}
break;
@ -8666,7 +8666,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->metric,
nm_platform_ip4_route_get_n_nexthops(obj),
obj->gateway,
(guint8) MAX(obj->weight, 1u),
(guint8) NM_MAX(obj->weight, 1u),
nmp_utils_ip_config_source_round_trip_rtprot(obj->rt_source),
_ip_route_scope_inv_get_normalized(obj),
obj->tos,

View file

@ -218,12 +218,12 @@ size_request_buttons(NmtNewtButtonBox *bbox, GPtrArray *buttons, int *width, int
*width += child_width;
if (i > 0)
*width += 1;
*height = MAX(*height, child_height);
*height = NM_MAX(*height, child_height);
} else {
*height += child_height;
if (i > 0)
*height += 1;
*width = MAX(*width, child_width);
*width = NM_MAX(*width, child_width);
}
}
}

View file

@ -249,7 +249,7 @@ nmt_newt_section_size_request(NmtNewtWidget *widget, int *width, int *height)
nmt_newt_widget_size_request(priv->header, &priv->hwidth_req, &priv->hheight_req);
nmt_newt_widget_size_request(priv->body, &priv->bwidth_req, &priv->bheight_req);
*width = MAX(priv->hwidth_req, priv->bwidth_req) + 2;
*width = NM_MAX(priv->hwidth_req, priv->bwidth_req) + 2;
if (priv->open)
*height = priv->hheight_req + priv->bheight_req + (priv->show_border ? 1 : 0);
else

View file

@ -65,7 +65,7 @@ nmt_newt_dialog_g_log_handler(const char *log_domain,
*/
newtGetScreenSize(&screen_width, &screen_height);
text = newtTextboxReflowed(-1, -1, full_message, MAX(70, screen_width - 10), 0, 0, 0);
text = newtTextboxReflowed(-1, -1, full_message, NM_MAX(70, screen_width - 10), 0, 0, 0);
g_free(full_message);
ok = newtButton(-1, -1, "OK");

View file

@ -76,7 +76,7 @@ _print_progress(gboolean wait_startup, int progress_next_step_i, gint64 remainin
g_print("\r%s", _("Connecting"));
for (i = 0; i < PROGRESS_STEPS; i++)
putchar(i < j ? '.' : ' ');
g_print(" %4lds", (long) (MAX(0, remaining_ms + 999) / 1000));
g_print(" %4lds", (long) (NM_MAX(0, remaining_ms + 999) / 1000));
if (retval != EXIT_NONE) {
const char *result;

View file

@ -480,7 +480,7 @@ nmt_connect_connection_list_rebuild(NmtConnectConnectionList *list)
for (citer = nmtdev->conns; citer; citer = citer->next) {
nmtconn = citer->data;
max_width = MAX(max_width, nmt_newt_text_width(nmtconn->name));
max_width = NM_MAX(max_width, nmt_newt_text_width(nmtconn->name));
}
}

View file

@ -326,10 +326,10 @@ nmt_editor_grid_size_request(NmtNewtWidget *widget, int *width, int *height)
if (rows[i].label) {
nmt_newt_widget_size_request(rows[i].label, &lwidth, &lheight);
lwidth += priv->indent;
state->col_widths[0] = MAX(state->col_widths[0], lwidth);
state->col_widths[0] = NM_MAX(state->col_widths[0], lwidth);
nmt_newt_widget_size_request(rows[i].widget, &wwidth, &wheight);
state->col_widths[1] = MAX(state->col_widths[1], wwidth);
state->col_widths[1] = NM_MAX(state->col_widths[1], wwidth);
priv->row_heights[i] = wheight;
add_padding = TRUE;
@ -340,8 +340,8 @@ nmt_editor_grid_size_request(NmtNewtWidget *widget, int *width, int *height)
if (rows[i].extra) {
nmt_newt_widget_size_request(rows[i].extra, &ewidth, &eheight);
state->col_widths[2] = MAX(state->col_widths[2], ewidth);
priv->row_heights[i] = MAX(priv->row_heights[i], eheight);
state->col_widths[2] = NM_MAX(state->col_widths[2], ewidth);
priv->row_heights[i] = NM_MAX(priv->row_heights[i], eheight);
}
*height += priv->row_heights[i];

View file

@ -185,8 +185,8 @@ nmt_route_table_init(NmtRouteTable *table)
metric_width = nmt_newt_text_width(text);
nmt_newt_grid_add(NMT_NEWT_GRID(header), metric_label, 2, 0);
priv->ip_entry_width = MAX(20, MAX(dest_prefix_width, next_hop_width));
priv->metric_entry_width = MAX(7, metric_width);
priv->ip_entry_width = NM_MAX(20, NM_MAX(dest_prefix_width, next_hop_width));
priv->metric_entry_width = NM_MAX(7, metric_width);
nmt_newt_widget_set_padding(dest_prefix_label,
0,

View file

@ -326,8 +326,8 @@ listbox_active_changed(GObject *object, GParamSpec *pspec, gpointer button)
deactivate = _("Deactivate");
deactivate_width = nmt_newt_text_width(deactivate);
activate_padding = MAX(0, deactivate_width - activate_width);
deactivate_padding = MAX(0, activate_width - deactivate_width);
activate_padding = NM_MAX(0, deactivate_width - activate_width);
deactivate_padding = NM_MAX(0, activate_width - deactivate_width);
}
has_selection = nmt_connect_connection_list_get_selection(list, NULL, NULL, NULL, &ac);