HomeClusterLabs Projects

Refactor: libcrmcommon: New pcmk__parse_ms()
342d8ac27495Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.
This commit no longer exists in the repository. It may have been part of a branch which was deleted.This commit has been deleted in the repository: it is no longer reachable from any branch, tag, or ref.

Description

Refactor: libcrmcommon: New pcmk__parse_ms()

To replace crm_get_msec().

There are a lot of parsing improvements that would be welcome (see
T841), but we'll have to be careful about making them. We're parsing
user inputs with this function. So changing how we respond to invalid
values, values that contain some garbage at the end, etc., affects user-
facing behavior, even though the function is internal.

This function basically preserves existing behavior for now, including
that it doesn't yet allow negative values. One key difference is that we
no longer use PCMK__PARSE_INT_DEFAULT inside it in any way. The output
argument (dest) remains unchanged if there is any error besides ERANGE.

Also improve unit tests for overflow, and add a test for negative input
that doesn't overflow.

Ref T841

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

Details

Provenance
nrwahl2Authored on Mar 20 2025, 11:49 PM

Event Timeline

Commit No Longer Exists

This commit no longer exists in the repository.