diff options
author | Thomas Haller <thaller@redhat.com> | 2018-07-11 07:40:19 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-07-11 12:02:06 +0200 |
commit | e1c7a2b5d0b142a3d4347ec6f1934f53c4b402a9 (patch) | |
tree | f61f41729ed8844d566eb68c69d9550a07564215 /src/platform/nm-linux-platform.c | |
parent | 7e98b4cad2ff9934d8b5855b291c2baaa7543801 (diff) |
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/nm-linux-platform.c')
-rw-r--r-- | src/platform/nm-linux-platform.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 592a5b14b..e02269f6e 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); |