Skip to content

Commit 832596d

Browse files
committed
API: libcrmcommon: Deprecate crm_element_value_ll()
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent f55aef5 commit 832596d

3 files changed

Lines changed: 24 additions & 32 deletions

File tree

include/crm/common/xml_element.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const char *crm_xml_add_timeval(xmlNode *xml, const char *name_sec,
3535

3636
const char *crm_element_value(const xmlNode *data, const char *name);
3737
int crm_element_value_int(const xmlNode *data, const char *name, int *dest);
38-
int crm_element_value_ll(const xmlNode *data, const char *name, long long *dest);
3938
char *crm_element_value_copy(const xmlNode *data, const char *name);
4039

4140
#ifdef __cplusplus

include/crm/common/xml_element_compat.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ int crm_element_value_epoch(const xmlNode *xml, const char *name, time_t *dest);
5151
//! \deprecated Do not use
5252
int crm_element_value_ms(const xmlNode *data, const char *name, guint *dest);
5353

54+
//! \deprecated Do not use
55+
int crm_element_value_ll(const xmlNode *data, const char *name,
56+
long long *dest);
57+
5458
#ifdef __cplusplus
5559
}
5660
#endif

lib/common/xml_element.c

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,37 +1423,6 @@ pcmk__xe_get_timeval(const xmlNode *xml, const char *sec_attr,
14231423
return pcmk_rc_ok;
14241424
}
14251425

1426-
/*!
1427-
* \brief Retrieve the long long integer value of an XML attribute
1428-
*
1429-
* This is like \c crm_element_value() but getting the value as a long long int.
1430-
*
1431-
* \param[in] data XML node to check
1432-
* \param[in] name Attribute name to check
1433-
* \param[out] dest Where to store element value
1434-
*
1435-
* \return 0 on success, -1 otherwise
1436-
*/
1437-
int
1438-
crm_element_value_ll(const xmlNode *data, const char *name, long long *dest)
1439-
{
1440-
const char *value = NULL;
1441-
1442-
CRM_CHECK(dest != NULL, return -1);
1443-
value = crm_element_value(data, name);
1444-
if (value != NULL) {
1445-
int rc = pcmk__scan_ll(value, dest, PCMK__PARSE_INT_DEFAULT);
1446-
1447-
if (rc == pcmk_rc_ok) {
1448-
return 0;
1449-
}
1450-
crm_warn("Using default for %s "
1451-
"because '%s' is not a valid integer: %s",
1452-
name, value, pcmk_rc_str(rc));
1453-
}
1454-
return -1;
1455-
}
1456-
14571426
/*!
14581427
* \internal
14591428
* \brief Get a date/time object from an XML attribute value
@@ -1648,6 +1617,26 @@ crm_copy_xml_element(const xmlNode *obj1, xmlNode *obj2, const char *element)
16481617
return value;
16491618
}
16501619

1620+
int
1621+
crm_element_value_ll(const xmlNode *data, const char *name, long long *dest)
1622+
{
1623+
const char *value = NULL;
1624+
1625+
CRM_CHECK(dest != NULL, return -1);
1626+
value = crm_element_value(data, name);
1627+
if (value != NULL) {
1628+
int rc = pcmk__scan_ll(value, dest, PCMK__PARSE_INT_DEFAULT);
1629+
1630+
if (rc == pcmk_rc_ok) {
1631+
return 0;
1632+
}
1633+
crm_warn("Using default for %s "
1634+
"because '%s' is not a valid integer: %s",
1635+
name, value, pcmk_rc_str(rc));
1636+
}
1637+
return -1;
1638+
}
1639+
16511640
int
16521641
crm_element_value_timeval(const xmlNode *xml, const char *name_sec,
16531642
const char *name_usec, struct timeval *dest)

0 commit comments

Comments
 (0)