10 #ifndef PCMK__STRINGS_INTERNAL__H 11 #define PCMK__STRINGS_INTERNAL__H 19 #define PCMK__PARSE_INT_DEFAULT -1 20 #define PCMK__PARSE_DBL_DEFAULT -1.0 33 const char *default_text,
char **end_text);
41 const char *separator);
43 char **
result,
unsigned int *result_len);
51 GDestroyNotify value_destroy_func);
53 GDestroyNotify value_destroy_func);
66 static inline GHashTable *
67 pcmk__intkey_table(GDestroyNotify value_destroy_func)
69 return g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL,
85 static inline gboolean
86 pcmk__intkey_table_insert(GHashTable *hash_table,
int key, gpointer value)
88 return g_hash_table_insert(hash_table, GINT_TO_POINTER(key), value);
100 static inline gpointer
101 pcmk__intkey_table_lookup(GHashTable *hash_table,
int key)
103 return g_hash_table_lookup(hash_table, GINT_TO_POINTER(key));
115 static inline gboolean
116 pcmk__intkey_table_remove(GHashTable *hash_table,
int key)
118 return g_hash_table_remove(hash_table, GINT_TO_POINTER(key));
132 pcmk__str_eq(const
char *s1, const
char *s2, uint32_t
flags)
139 pcmk__add_word(
char **list,
size_t *len,
const char *word)
162 #define pcmk__plural_alt(i, s1, s2) (((i) == 1)? (s1) : (s2)) 165 #define pcmk__plural_s(i) pcmk__plural_alt(i, "", "s") 168 pcmk__str_empty(
const char *s)
170 return (s == NULL) || (s[0] ==
'\0');
174 pcmk__itoa(
int an_int)
180 pcmk__ftoa(
double a_float)
186 pcmk__ttoa(time_t epoch_time)
192 static inline const char *
193 pcmk__btoa(
bool condition)
195 return condition?
"true" :
"false";
void pcmk__add_separated_word(char **list, size_t *len, const char *word, const char *separator)
bool pcmk__char_in_any_str(int ch,...) G_GNUC_NULL_TERMINATED
int pcmk__scan_min_int(const char *text, int *result, int minimum)
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
bool pcmk__ends_with(const char *s, const char *match)
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
int pcmk__scan_port(const char *text, int *port)
int pcmk__guint_from_hash(GHashTable *table, const char *key, guint default_val, guint *result)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
void pcmk__str_update(char **str, const char *value)
gboolean pcmk__str_in_list(const gchar *s, GList *lst, uint32_t flags)
int pcmk__compress(const char *data, unsigned int length, unsigned int max, char **result, unsigned int *result_len)
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
int pcmk__scan_double(const char *text, double *result, const char *default_text, char **end_text)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
pcmk__action_result_t result
GHashTable * pcmk__str_table_dup(GHashTable *old_table)
int pcmk__strcmp(const char *s1, const char *s2, uint32_t flags)
int pcmk__numeric_strcasecmp(const char *s1, const char *s2)
int pcmk__parse_ll_range(const char *srcstring, long long *start, long long *end)
bool pcmk__starts_with(const char *str, const char *prefix)
Check whether a string starts with a certain sequence.
char * pcmk__trim(char *str)
bool pcmk__ends_with_ext(const char *s, const char *match)
GHashTable * pcmk__strikey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)