Skip to content

Commit db8a48f

Browse files
committed
Refactor: various: Replace gconstpointer with const void *
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>
1 parent d46c9a5 commit db8a48f

25 files changed

Lines changed: 36 additions & 36 deletions

daemons/fenced/fenced_history.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ stonith_fence_history_cleanup(const char *target,
145145
* 0 if the values are equal, and a positive integer if \p a is greater)
146146
*/
147147
static int
148-
cmp_op_by_completion(gconstpointer a, gconstpointer b)
148+
cmp_op_by_completion(const void *a, const void *b)
149149
{
150150
const remote_fencing_op_t *op1 = a;
151151
const remote_fencing_op_t *op2 = b;

daemons/fenced/fenced_remote.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static int get_op_total_timeout(const remote_fencing_op_t *op,
8989
const peer_device_info_t *chosen_peer);
9090

9191
static int
92-
sort_strings(gconstpointer a, gconstpointer b)
92+
sort_strings(const void *a, const void *b)
9393
{
9494
return strcmp(a, b);
9595
}
@@ -2110,7 +2110,7 @@ request_peer_fencing(remote_fencing_op_t *op, peer_device_info_t *peer)
21102110
* if the first value comes after the second."
21112111
*/
21122112
static int
2113-
sort_peers(gconstpointer a, gconstpointer b)
2113+
sort_peers(const void *a, const void *b)
21142114
{
21152115
const peer_device_info_t *peer_a = a;
21162116
const peer_device_info_t *peer_b = b;

include/crm/common/nvpair_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef struct {
4343
crm_time_t *next_change;
4444
} pcmk__nvpair_unpack_t;
4545

46-
int pcmk__cmp_nvpair_blocks(gconstpointer a, gconstpointer b, void *user_data);
46+
int pcmk__cmp_nvpair_blocks(const void *a, const void *b, void *user_data);
4747

4848
void pcmk__unpack_nvpair_block(void *data, void *user_data);
4949

include/crm/pengine/internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ void resource_location(pcmk_resource_t *rsc, const pcmk_node_t *node, int score,
231231
const char *tag, pcmk_scheduler_t *scheduler);
232232

233233
int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b);
234-
int sort_op_by_callid(gconstpointer a, gconstpointer b);
234+
int sort_op_by_callid(const void *a, const void *b);
235235
gboolean get_target_role(const pcmk_resource_t *rsc, enum rsc_role_e *role);
236236
void pe__set_next_role(pcmk_resource_t *rsc, enum rsc_role_e role,
237237
const char *why);
@@ -258,7 +258,7 @@ pe_base_name_eq(const pcmk_resource_t *rsc, const char *id)
258258

259259
int pe__target_rc_from_xml(const xmlNode *xml_op);
260260

261-
int pe__cmp_node_name(gconstpointer a, gconstpointer b);
261+
int pe__cmp_node_name(const void *a, const void *b);
262262
bool is_set_recursive(const pcmk_resource_t *rsc, long long flag, bool any);
263263

264264
pcmk__op_digest_t *pe__calculate_digests(pcmk_resource_t *rsc, const char *task,

lib/cib/cib_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
static GHashTable *cib_op_callback_table = NULL;
2929

3030
static int
31-
ciblib_GCompareFunc(gconstpointer a, gconstpointer b)
31+
ciblib_GCompareFunc(const void *a, const void *b)
3232
{
3333
int rc = 0;
3434
const cib_notify_client_t *a_client = a;

lib/common/nvpair.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ crm_meta_value(GHashTable *meta, const char *attr_name)
581581
* \note This is suitable for use as a GList sorting function.
582582
*/
583583
int
584-
pcmk__cmp_nvpair_blocks(gconstpointer a, gconstpointer b, void *user_data)
584+
pcmk__cmp_nvpair_blocks(const void *a, const void *b, void *user_data)
585585
{
586586
const xmlNode *pair_a = a;
587587
const xmlNode *pair_b = b;
@@ -659,7 +659,7 @@ pcmk__cmp_nvpair_blocks(gconstpointer a, gconstpointer b, void *user_data)
659659
#include <crm/common/nvpair_compat.h>
660660

661661
static int
662-
pcmk__compare_nvpair(gconstpointer a, gconstpointer b)
662+
pcmk__compare_nvpair(const void *a, const void *b)
663663
{
664664
int rc = 0;
665665
const pcmk_nvpair_t *pair_a = a;

lib/common/patchset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ typedef struct {
622622
} xml_change_obj_t;
623623

624624
static int
625-
sort_change_obj_by_position(gconstpointer a, gconstpointer b)
625+
sort_change_obj_by_position(const void *a, const void *b)
626626
{
627627
const xml_change_obj_t *change_obj_a = a;
628628
const xml_change_obj_t *change_obj_b = b;

lib/common/schemas.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ pcmk__load_schemas_from_dir(const char *dir)
483483
}
484484

485485
static int
486-
schema_sort_GCompareFunc(gconstpointer a, gconstpointer b)
486+
schema_sort_GCompareFunc(const void *a, const void *b)
487487
{
488488
const pcmk__schema_t *schema_a = a;
489489
const pcmk__schema_t *schema_b = b;

lib/common/strings.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ pcmk_parse_interval_spec(const char *input, unsigned int *result_ms)
422422
* in the transition graph.
423423
*/
424424
static unsigned int
425-
pcmk__str_hash(gconstpointer v)
425+
pcmk__str_hash(const void *v)
426426
{
427427
const signed char *p;
428428
guint32 h = 0;
@@ -472,13 +472,13 @@ pcmk__insert_dup(GHashTable *table, const char *name, const char *value)
472472

473473
/* used with hash tables where case does not matter */
474474
static gboolean
475-
pcmk__strcase_equal(gconstpointer a, gconstpointer b)
475+
pcmk__strcase_equal(const void *a, const void *b)
476476
{
477477
return pcmk__str_eq((const char *)a, (const char *)b, pcmk__str_casei);
478478
}
479479

480480
static unsigned int
481-
pcmk__strcase_hash(gconstpointer v)
481+
pcmk__strcase_hash(const void *v)
482482
{
483483
const signed char *p;
484484
guint32 h = 0;
@@ -944,7 +944,7 @@ struct str_in_list_data {
944944
* (according to \p b->flags)
945945
*/
946946
static int
947-
cmp_str_in_list(gconstpointer a, gconstpointer b)
947+
cmp_str_in_list(const void *a, const void *b)
948948
{
949949
const char *element = a;
950950
const struct str_in_list_data *data = b;

lib/common/xml_element.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pcmk__xe_copy_attrs(xmlNode *target, const xmlNode *src, uint32_t flags)
287287
* lexicographically
288288
*/
289289
static int
290-
compare_xml_attr(gconstpointer a, gconstpointer b)
290+
compare_xml_attr(const void *a, const void *b)
291291
{
292292
const xmlAttr *attr_a = a;
293293
const xmlAttr *attr_b = b;

0 commit comments

Comments
 (0)