#include <crm_internal.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
Go to the source code of this file.
◆ _GNU_SOURCE
◆ char2score()
int char2score |
( |
const char * |
score | ) |
|
Get the integer value of a score string.
Given a string representation of a score, return the integer equivalent. This accepts infinity strings as well as red, yellow, and green, and bounds the result to +/-INFINITY.
- Parameters
-
- Returns
- Integer value corresponding to
score
Definition at line 36 of file scores.c.
◆ pcmk__add_scores()
int pcmk__add_scores |
( |
int |
score1, |
|
|
int |
score2 |
|
) |
| |
◆ score2char()
char* score2char |
( |
int |
score | ) |
|
Return the string equivalent of an integer score.
Return the string equivalent of a given integer score, using "INFINITY" and "-INFINITY" when appropriate.
- Parameters
-
[in] | score | Integer score to convert |
- Returns
- Newly allocated string equivalent of
score
- Note
- The caller is responsible for freeing the return value. This function asserts on memory errors, so the return value can be assumed to be non-NULL.
Definition at line 114 of file scores.c.
◆ score2char_stack()
char* score2char_stack |
( |
int |
score, |
|
|
char * |
buf, |
|
|
size_t |
len |
|
) |
| |
Convert an integer score to a string, using a provided buffer.
Store the string equivalent of a given integer score in a given string buffer, using "INFINITY" and "-INFINITY" when appropriate.
- Parameters
-
[in] | score | Integer score to convert |
[out] | buf | Where to store string representation of score |
[in] | len | Size of buf (in bytes) |
- Returns
buf
(or NULL if len
is too small)
Definition at line 85 of file scores.c.
◆ pcmk__score_green
int pcmk__score_green = 0 |
◆ pcmk__score_red
◆ pcmk__score_yellow
int pcmk__score_yellow = 0 |