pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
strings_internal.h File Reference
#include <stdbool.h>
#include <glib.h>
Include dependency graph for strings_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PCMK__PARSE_INT_DEFAULT   -1
 
#define PCMK__PARSE_DBL_DEFAULT   -1.0
 
#define pcmk__plural_alt(i, s1, s2)   (((i) == 1)? (s1) : (s2))
 
#define pcmk__plural_s(i)   pcmk__plural_alt(i, "", "s")
 

Enumerations

enum  pcmk__str_flags { pcmk__str_none = 0, pcmk__str_casei = 1 << 0, pcmk__str_null_matches = 1 << 1, pcmk__str_regex = 1 << 2 }
 

Functions

int pcmk__scan_double (const char *text, double *result, const char *default_text, char **end_text)
 
int pcmk__guint_from_hash (GHashTable *table, const char *key, guint default_val, guint *result)
 
bool pcmk__starts_with (const char *str, const char *prefix)
 Check whether a string starts with a certain sequence. More...
 
bool pcmk__ends_with (const char *s, const char *match)
 
bool pcmk__ends_with_ext (const char *s, const char *match)
 
char * pcmk__trim (char *str)
 
void pcmk__add_separated_word (char **list, size_t *len, const char *word, const char *separator)
 
int pcmk__compress (const char *data, unsigned int length, unsigned int max, char **result, unsigned int *result_len)
 
int pcmk__scan_ll (const char *text, long long *result, long long default_value)
 
int pcmk__scan_min_int (const char *text, int *result, int minimum)
 
int pcmk__scan_port (const char *text, int *port)
 
int pcmk__parse_ll_range (const char *srcstring, long long *start, long long *end)
 
GHashTable * pcmk__strkey_table (GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
 
GHashTable * pcmk__strikey_table (GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
 
GHashTable * pcmk__str_table_dup (GHashTable *old_table)
 
gboolean pcmk__str_in_list (GList *lst, const gchar *s)
 
bool pcmk__strcase_any_of (const char *s,...) G_GNUC_NULL_TERMINATED
 
bool pcmk__str_any_of (const char *s,...) G_GNUC_NULL_TERMINATED
 
bool pcmk__char_in_any_str (int ch,...) G_GNUC_NULL_TERMINATED
 
int pcmk__strcmp (const char *s1, const char *s2, uint32_t flags)
 
int pcmk__numeric_strcasecmp (const char *s1, const char *s2)
 

Macro Definition Documentation

#define PCMK__PARSE_DBL_DEFAULT   -1.0

Definition at line 20 of file strings_internal.h.

#define PCMK__PARSE_INT_DEFAULT   -1

Definition at line 19 of file strings_internal.h.

#define pcmk__plural_alt (   i,
  s1,
  s2 
)    (((i) == 1)? (s1) : (s2))

Definition at line 160 of file strings_internal.h.

#define pcmk__plural_s (   i)    pcmk__plural_alt(i, "", "s")

Definition at line 163 of file strings_internal.h.

Enumeration Type Documentation

Enumerator
pcmk__str_none 
pcmk__str_casei 
pcmk__str_null_matches 
pcmk__str_regex 

Definition at line 24 of file strings_internal.h.

Function Documentation

void pcmk__add_separated_word ( char **  list,
size_t *  len,
const char *  word,
const char *  separator 
)

Definition at line 702 of file strings.c.

bool pcmk__char_in_any_str ( int  ch,
  ... 
)

Definition at line 976 of file strings.c.

int pcmk__compress ( const char *  data,
unsigned int  length,
unsigned int  max,
char **  result,
unsigned int *  result_len 
)

Definition at line 748 of file strings.c.

bool pcmk__ends_with ( const char *  s,
const char *  match 
)

Definition at line 535 of file strings.c.

bool pcmk__ends_with_ext ( const char *  s,
const char *  match 
)

Definition at line 562 of file strings.c.

int pcmk__guint_from_hash ( GHashTable *  table,
const char *  key,
guint  default_val,
guint *  result 
)

Definition at line 311 of file strings.c.

int pcmk__numeric_strcasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 1019 of file strings.c.

int pcmk__parse_ll_range ( const char *  srcstring,
long long *  start,
long long *  end 
)

Definition at line 812 of file strings.c.

int pcmk__scan_double ( const char *  text,
double *  result,
const char *  default_text,
char **  end_text 
)

Definition at line 199 of file strings.c.

int pcmk__scan_ll ( const char *  text,
long long *  result,
long long  default_value 
)

Definition at line 97 of file strings.c.

int pcmk__scan_min_int ( const char *  text,
int *  result,
int  minimum 
)

Definition at line 127 of file strings.c.

int pcmk__scan_port ( const char *  text,
int *  port 
)

Definition at line 161 of file strings.c.

bool pcmk__starts_with ( const char *  str,
const char *  prefix 
)

Check whether a string starts with a certain sequence.

Parameters
[in]strString to check
[in]prefixSequence to match against beginning of str
Returns
true if str begins with match, false otherwise
Note
This is equivalent to !strncmp(s, prefix, strlen(prefix)) but is likely less efficient when prefix is a string literal if the compiler optimizes away the strlen() at compile time, and more efficient otherwise.

Definition at line 483 of file strings.c.

bool pcmk__str_any_of ( const char *  s,
  ... 
)

Definition at line 953 of file strings.c.

gboolean pcmk__str_in_list ( GList *  lst,
const gchar *  s 
)

Definition at line 881 of file strings.c.

GHashTable* pcmk__str_table_dup ( GHashTable *  old_table)

Definition at line 674 of file strings.c.

bool pcmk__strcase_any_of ( const char *  s,
  ... 
)

Definition at line 929 of file strings.c.

int pcmk__strcmp ( const char *  s1,
const char *  s2,
uint32_t  flags 
)

Definition at line 1097 of file strings.c.

GHashTable* pcmk__strikey_table ( GDestroyNotify  key_destroy_func,
GDestroyNotify  value_destroy_func 
)

Definition at line 648 of file strings.c.

GHashTable* pcmk__strkey_table ( GDestroyNotify  key_destroy_func,
GDestroyNotify  value_destroy_func 
)

Definition at line 610 of file strings.c.

char* pcmk__trim ( char *  str)

Definition at line 455 of file strings.c.