Skip to content

Commit 99d116d

Browse files
committed
Refactor: libcrmcommon: pcmk__guint_from_hash -> pcmk__uint_from_hash
We're no longer using the guint alias. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent 04743ef commit 99d116d

9 files changed

Lines changed: 25 additions & 22 deletions

File tree

daemons/controld/controld_execd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,8 +1625,8 @@ construct_op(const lrm_state_t *lrm_state, const xmlNode *rsc_op,
16251625
op_timeout = crm_meta_value(params, PCMK_META_TIMEOUT);
16261626
pcmk__scan_min_int(op_timeout, &op->timeout, 0);
16271627

1628-
if (pcmk__guint_from_hash(params, CRM_META "_" PCMK_META_INTERVAL, 0,
1629-
&(op->interval_ms)) != pcmk_rc_ok) {
1628+
if (pcmk__uint_from_hash(params, CRM_META "_" PCMK_META_INTERVAL, 0,
1629+
&(op->interval_ms)) != pcmk_rc_ok) {
16301630
op->interval_ms = 0;
16311631
}
16321632

include/crm/common/strings_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ enum pcmk__str_flags {
4343

4444
int pcmk__scan_double(const char *text, double *result,
4545
const char *default_text, char **end_text);
46-
int pcmk__guint_from_hash(GHashTable *table, const char *key,
47-
unsigned int default_val, unsigned int *result);
46+
int pcmk__uint_from_hash(GHashTable *table, const char *key,
47+
unsigned int default_val, unsigned int *result);
4848
void pcmk__add_separated_word(GString **list, size_t init_size,
4949
const char *word, const char *separator);
5050
int pcmk__compress(const char *data, unsigned int length, unsigned int max,

lib/common/strings.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ pcmk__scan_double(const char *text, double *result, const char *default_text,
308308
* \return Standard Pacemaker return code
309309
*/
310310
int
311-
pcmk__guint_from_hash(GHashTable *table, const char *key,
312-
unsigned int default_val, unsigned int *result)
311+
pcmk__uint_from_hash(GHashTable *table, const char *key,
312+
unsigned int default_val, unsigned int *result)
313313
{
314314
const char *value;
315315
long long value_ll;

lib/common/tests/strings/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ check_PROGRAMS = pcmk__add_word_test
1616
check_PROGRAMS += pcmk__btoa_test
1717
check_PROGRAMS += pcmk__compress_test
1818
check_PROGRAMS += pcmk__g_strcat_test
19-
check_PROGRAMS += pcmk__guint_from_hash_test
2019
check_PROGRAMS += pcmk__numeric_strcasecmp_test
2120
check_PROGRAMS += pcmk__parse_bool_test
2221
check_PROGRAMS += pcmk__parse_ll_range_test
@@ -33,5 +32,6 @@ check_PROGRAMS += pcmk__str_update_test
3332
check_PROGRAMS += pcmk__strcmp_test
3433
check_PROGRAMS += pcmk__strkey_table_test
3534
check_PROGRAMS += pcmk__strikey_table_test
35+
check_PROGRAMS += pcmk__uint_from_hash_test
3636

3737
TESTS = $(check_PROGRAMS)

lib/common/tests/strings/pcmk__guint_from_hash_test.c renamed to lib/common/tests/strings/pcmk__uint_from_hash_test.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ null_args(void **state)
1919
GHashTable *tbl = pcmk__strkey_table(free, free);
2020
unsigned int result = 0;
2121

22-
assert_int_equal(pcmk__guint_from_hash(NULL, "abc", 123, &result), EINVAL);
23-
assert_int_equal(pcmk__guint_from_hash(tbl, NULL, 123, &result), EINVAL);
22+
assert_int_equal(pcmk__uint_from_hash(NULL, "abc", 123, &result), EINVAL);
23+
assert_int_equal(pcmk__uint_from_hash(tbl, NULL, 123, &result), EINVAL);
2424

2525
g_hash_table_destroy(tbl);
2626
}
@@ -31,7 +31,8 @@ missing_key(void **state)
3131
GHashTable *tbl = pcmk__strkey_table(free, free);
3232
unsigned int result = 0;
3333

34-
assert_int_equal(pcmk__guint_from_hash(tbl, "abc", 123, &result), pcmk_rc_ok);
34+
assert_int_equal(pcmk__uint_from_hash(tbl, "abc", 123, &result),
35+
pcmk_rc_ok);
3536
assert_int_equal(result, 123);
3637

3738
g_hash_table_destroy(tbl);
@@ -45,7 +46,8 @@ standard_usage(void **state)
4546

4647
g_hash_table_insert(tbl, strdup("abc"), strdup("123"));
4748

48-
assert_int_equal(pcmk__guint_from_hash(tbl, "abc", 456, &result), pcmk_rc_ok);
49+
assert_int_equal(pcmk__uint_from_hash(tbl, "abc", 456, &result),
50+
pcmk_rc_ok);
4951
assert_int_equal(result, 123);
5052

5153
g_hash_table_destroy(tbl);
@@ -61,13 +63,14 @@ conversion_errors(void **state)
6163
g_hash_table_insert(tbl, strdup("toobig"), strdup("20000000000000000"));
6264
g_hash_table_insert(tbl, strdup("baddata"), strdup("asdf"));
6365

64-
assert_int_equal(pcmk__guint_from_hash(tbl, "negative", 456, &result), ERANGE);
66+
assert_int_equal(pcmk__uint_from_hash(tbl, "negative", 456, &result),
67+
ERANGE);
6568
assert_int_equal(result, 456);
6669

67-
assert_int_equal(pcmk__guint_from_hash(tbl, "toobig", 456, &result), ERANGE);
70+
assert_int_equal(pcmk__uint_from_hash(tbl, "toobig", 456, &result), ERANGE);
6871
assert_int_equal(result, 456);
6972

70-
assert_int_equal(pcmk__guint_from_hash(tbl, "baddata", 456, &result),
73+
assert_int_equal(pcmk__uint_from_hash(tbl, "baddata", 456, &result),
7174
pcmk_rc_bad_input);
7275
assert_int_equal(result, 456);
7376

lib/pacemaker/pcmk_graph_consumer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,8 @@ unpack_action(pcmk__graph_synapse_t *parent, xmlNode *xml_action)
596596
action->timeout += start_delay;
597597
}
598598

599-
if (pcmk__guint_from_hash(action->params, CRM_META "_" PCMK_META_INTERVAL,
600-
0, &(action->interval_ms)) != pcmk_rc_ok) {
599+
if (pcmk__uint_from_hash(action->params, CRM_META "_" PCMK_META_INTERVAL,
600+
0, &(action->interval_ms)) != pcmk_rc_ok) {
601601
action->interval_ms = 0;
602602
}
603603

lib/pacemaker/pcmk_graph_producer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ create_graph_action(xmlNode *parent, pcmk_action_t *action, bool skip_details,
440440
char *clone_key = NULL;
441441
unsigned int interval_ms = 0;
442442

443-
if (pcmk__guint_from_hash(action->meta, PCMK_META_INTERVAL, 0,
444-
&interval_ms) != pcmk_rc_ok) {
443+
if (pcmk__uint_from_hash(action->meta, PCMK_META_INTERVAL, 0,
444+
&interval_ms) != pcmk_rc_ok) {
445445
interval_ms = 0;
446446
}
447447
clone_key = clone_op_key(action, interval_ms);

lib/pacemaker/pcmk_sched_recurring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,8 @@ pcmk__action_is_recurring(const pcmk_action_t *action)
748748
{
749749
unsigned int interval_ms = 0;
750750

751-
if (pcmk__guint_from_hash(action->meta, PCMK_META_INTERVAL, 0,
752-
&interval_ms) != pcmk_rc_ok) {
751+
if (pcmk__uint_from_hash(action->meta, PCMK_META_INTERVAL, 0,
752+
&interval_ms) != pcmk_rc_ok) {
753753
return false;
754754
}
755755
return (interval_ms > 0);

lib/pacemaker/pcmk_simulate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ create_action_name(const pcmk_action_t *action, bool verbose)
7272
char *key = NULL;
7373
unsigned int interval_ms = 0;
7474

75-
if (pcmk__guint_from_hash(action->meta, PCMK_META_INTERVAL, 0,
76-
&interval_ms) != pcmk_rc_ok) {
75+
if (pcmk__uint_from_hash(action->meta, PCMK_META_INTERVAL, 0,
76+
&interval_ms) != pcmk_rc_ok) {
7777
interval_ms = 0;
7878
}
7979

0 commit comments

Comments
 (0)