Skip to content

Replace some GLib type aliases with native C types#4093

Merged
clumens merged 39 commits into
ClusterLabs:mainfrom
nrwahl2:nrwahl2-gint
Jun 3, 2026
Merged

Replace some GLib type aliases with native C types#4093
clumens merged 39 commits into
ClusterLabs:mainfrom
nrwahl2:nrwahl2-gint

Conversation

@nrwahl2

@nrwahl2 nrwahl2 commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

The GLib documentation says the standard types should be preferred in new code. See, for example, https://docs.gtk.org/glib/types.html#gint.

I'm opening this as a draft because it's so invasive and is likely to conflict with other ongoing work.

@nrwahl2 nrwahl2 marked this pull request as ready for review May 1, 2026 16:53
@nrwahl2

nrwahl2 commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on main

@nrwahl2 nrwahl2 requested a review from clumens May 1, 2026 16:54
Comment thread daemons/controld/controld_cib.h Outdated
Comment thread lib/lrmd/lrmd_client.c Outdated
Comment thread lib/pacemaker/pcmk_simulate.c Outdated
Comment thread lib/common/tests/strings/pcmk__uint_from_hash_test.c Outdated
Comment thread lib/common/tests/strings/pcmk__uint_from_hash_test.c Outdated
Comment thread lib/common/tests/strings/pcmk__uint_from_hash_test.c Outdated
Comment thread lib/common/output_text.c Outdated
@clumens clumens added the review: in progress PRs that are currently being reviewed label Jun 2, 2026
nrwahl2 added 22 commits June 2, 2026 14:02
The GLib documentation says the standard int should be preferred in new
code. The two are equivalent (via typedef).

https://docs.gtk.org/glib/types.html#gint

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The GLib documentation says the standard UINT_MAX should be preferred in
new code. The two are equivalent (via define).

https://docs.gtk.org/glib/types.html#guint

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And replace xmlNodePtr with xmlNode *.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
nrwahl2 added 4 commits June 2, 2026 14:02
And replace xmlNodePtr with xmlNode *.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And replace xmlNodePtr with xmlNode *.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And replace xmlNodePtr with xmlNode *.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
@nrwahl2

nrwahl2 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Rebasing first on main to resolve conflict.

@nrwahl2 nrwahl2 marked this pull request as draft June 2, 2026 21:03
nrwahl2 added 11 commits June 2, 2026 14:25
The GLib documentation says the standard unsigned int should be
preferred in new code. The two are equivalent (via typedef). This means
it's also okay to change public API signatures that use guint.

https://docs.gtk.org/glib/types.html#guint

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
We're no longer using the guint alias.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
We're no longer using the guint alias.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
We're no longer using the guint alias.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The GLib documentation says the standard void * should be preferred in
new code. The two are equivalent (via typedef). This means it's also
okay to change public API signatures that use gpointer.

https://docs.gtk.org/glib/types.html#gpointer

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The GLib documentation says the standard const void * should be
preferred in new code. The two are equivalent (via typedef).

https://docs.gtk.org/glib/types.html#gconstpointer

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The GLib documentation says the standard char should be preferred in new
code. The two are equivalent (via typedef).

This commit replaces gchar with char in function input arguments but
continues to use gchar for output arguments and return values. We could
make an argument for keeping gchar in those cases as a reminder to use
g_free().

https://docs.gtk.org/glib/types.html#gchar

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
If you're creating or modifying the GList fields of a pcmk_injections_t
object manually, be sure to allocate the list elements using the
malloc() family of allocators. Previously, pcmk_free_injections()
assumed that the list elements had been allocated using the g_malloc()
family of allocators from GLib.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
...and replace gchar with char in two static buffers, since they don't
need to be freed.

The GLib documentation says the standard char should be preferred in new
code. The two are equivalent (via typedef).

We could make an argument for keeping gchar in non-const cases as a
reminder to use g_free(). So those replacements can be done in a later
commit, if at all.

https://docs.gtk.org/glib/types.html#gchar

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And drop the "ms" comments for two arguments.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
@nrwahl2 nrwahl2 marked this pull request as ready for review June 2, 2026 21:47
Comment thread lib/lrmd/lrmd_client.c Outdated
Comment thread lib/pacemaker/pcmk_simulate.c Outdated
nrwahl2 added 2 commits June 3, 2026 12:02
For clarity, in accordance with our naming conventions.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To align with our style guide.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
@nrwahl2

nrwahl2 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@clumens Removed space in * params.

@clumens clumens merged commit ced274c into ClusterLabs:main Jun 3, 2026
1 check passed
@nrwahl2 nrwahl2 deleted the nrwahl2-gint branch June 3, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: in progress PRs that are currently being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants