summaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-07-11 07:40:19 +0200
committerThomas Haller <thaller@redhat.com>2018-07-11 12:02:06 +0200
commite1c7a2b5d0b142a3d4347ec6f1934f53c4b402a9 (patch)
treef61f41729ed8844d566eb68c69d9550a07564215 /src/platform
parent7e98b4cad2ff9934d8b5855b291c2baaa7543801 (diff)
downloadNetworkManager-e1c7a2b5d0b142a3d4347ec6f1934f53c4b402a9.tar.gz
all: don't use gchar/gshort/gint/glong but C types
We commonly don't use the glib typedefs for char/short/int/long, but their C types directly. $ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l 587 $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l 21114 One could argue that using the glib typedefs is preferable in public API (of our glib based libnm library) or where it clearly is related to glib, like during g_object_set (obj, PROPERTY, (gint) value, NULL); However, that argument does not seem strong, because in practice we don't follow that argument today, and seldomly use the glib typedefs. Also, the style guide for this would be hard to formalize, because "using them where clearly related to a glib" is a very loose suggestion. Also note that glib typedefs will always just be typedefs of the underlying C types. There is no danger of glib changing the meaning of these typedefs (because that would be a major API break of glib). A simple style guide is instead: don't use these typedefs. No manual actions, I only ran the bash script: FILES=($(git ls-files '*.[hc]')) sed -i \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\> /\1 /g' \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \ "${FILES[@]}"
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/nm-linux-platform.c10
-rw-r--r--src/platform/nm-platform.c2
-rw-r--r--src/platform/tests/test-common.h2
-rw-r--r--src/platform/tests/test-link.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 592a5b14ba..e02269f6eb 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -3362,7 +3362,7 @@ typedef struct {
WaitForNlResponseResult *out_seq_result;
char **out_errmsg;
union {
- gint *out_refresh_all_in_progess;
+ int *out_refresh_all_in_progess;
NMPObject **out_route_get;
gpointer out_data;
} response;
@@ -3394,13 +3394,13 @@ typedef struct {
/* counter that a refresh all action is in progress, separated
* by type. */
- gint refresh_all_in_progess[_DELAYED_ACTION_IDX_REFRESH_ALL_NUM];
+ int refresh_all_in_progess[_DELAYED_ACTION_IDX_REFRESH_ALL_NUM];
GPtrArray *list_master_connected;
GPtrArray *list_refresh_link;
GArray *list_wait_for_nl_response;
- gint is_handling;
+ int is_handling;
} delayed_action;
int wireguard_family_id;
@@ -3923,7 +3923,7 @@ delayed_action_wait_for_nl_response_complete_check (NMPlatform *platform,
guint i;
guint32 next_seq_number = 0;
gint64 next_timeout_abs_ns = 0;
- gint now_ns = 0;
+ int now_ns = 0;
for (i = 0; i < priv->delayed_action.list_wait_for_nl_response->len; ) {
const DelayedActionWaitForNlResponseData *data = &g_array_index (priv->delayed_action.list_wait_for_nl_response, DelayedActionWaitForNlResponseData, i);
@@ -4621,7 +4621,7 @@ do_request_all_no_delayed_actions (NMPlatform *platform, DelayedActionType actio
const NMPClass *klass = nmp_class_from_type (obj_type);
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
int nle;
- gint *out_refresh_all_in_progess;
+ int *out_refresh_all_in_progess;
out_refresh_all_in_progess = &priv->delayed_action.refresh_all_in_progess[delayed_action_refresh_all_to_idx (iflags)];
nm_assert (*out_refresh_all_in_progess >= 0);
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 94a5ab0101..96465e3dd5 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -3787,7 +3787,7 @@ ip6_address_scope_priority (const struct in6_addr *addr)
return 3;
}
-static gint
+static int
ip6_address_scope_cmp (gconstpointer a, gconstpointer b)
{
const NMPlatformIP6Address *x = NMP_OBJECT_CAST_IP6_ADDRESS (*(const void **) a);
diff --git a/src/platform/tests/test-common.h b/src/platform/tests/test-common.h
index ed6e5791a0..1baadfa116 100644
--- a/src/platform/tests/test-common.h
+++ b/src/platform/tests/test-common.h
@@ -80,7 +80,7 @@ typedef struct {
gulong handler_id;
const char *name;
NMPlatformSignalChangeType change_type;
- gint received_count;
+ int received_count;
GMainLoop *loop;
int ifindex;
const char *ifname;
diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c
index ce0bb49e4f..854285357a 100644
--- a/src/platform/tests/test-link.c
+++ b/src/platform/tests/test-link.c
@@ -1835,7 +1835,7 @@ test_create_many_links_do (guint n_devices)
char name[64];
const NMPlatformLink *pllink;
gs_unref_array GArray *ifindexes = g_array_sized_new (FALSE, FALSE, sizeof (int), n_devices);
- const gint EX = ((int) (nmtst_get_rand_int () % 4)) - 1;
+ const int EX = ((int) (nmtst_get_rand_int () % 4)) - 1;
g_assert (EX >= -1 && EX <= 2);