46 const char **str = (
const char **) var;
51 if (*(
char **) var == (
char *) cdef->
initial)
53 *(
char **) var = NULL;
64 const char *value,
struct Buffer *err)
67 if (value && (value[0] ==
'\0'))
85 rc = cdef->
validator(cs, cdef, (intptr_t) value, err);
97 *(
const char **) var = str;
102 if (*(
char **) cdef->
var == (
char *) cdef->
initial)
121 const char *str = NULL;
124 str = *(
const char **) var;
139 const struct ConfigDef *cdef, intptr_t value,
142 const char *str = (
const char *) value;
145 if (str && (str[0] ==
'\0'))
161 rc = cdef->
validator(cs, cdef, value, err);
174 *(
const char **) var = str;
184 const char *str = *(
const char **) var;
186 return (intptr_t) str;
194 const char *value,
struct Buffer *err)
197 if (!value || (value && (value[0] ==
'\0')))
203 const char **var_str = (
const char **) var;
212 rc = cdef->
validator(cs, cdef, (intptr_t) str, err);
235 const char *str = (
const char *) cdef->
initial;
255 *(
const char **) var = str;
#define CSR_SUCCESS
Action completed successfully.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
static void string_destroy(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef)
Destroy a String - Implements ConfigSetType::destroy()
Type definition for a config item.
Container for lots of config items.
#define CSR_ERR_INVALID
Value hasn't been set.
Constants for all the config types.
#define DT_NOT_EMPTY
Empty strings are not allowed.
static int string_string_plus_equals(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, const char *value, struct Buffer *err)
Concat String to a string - Implements ConfigSetType::string_plus_equals.
A collection of config items.
intptr_t initial
Initial value.
String manipulation buffer.
char * mutt_str_dup(const char *str)
Copy a string, safely.
#define DT_INITIAL_SET
Config item must have its initial value freed.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
static int string_string_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a String as a string - Implements ConfigSetType::string_get()
#define CSR_SUC_EMPTY
Value is empty/unset.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
const char * name
User-visible name.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
#define DT_STRING
a string
int(* validator)(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate a config variable.
static int string_reset(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset a String to its initial value - Implements ConfigSetType::reset()
static int string_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set a String by string - Implements ConfigSetType::string_set()
uint32_t type
Variable type, e.g. DT_STRING.
static intptr_t string_native_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get a string from a String config item - Implements ConfigSetType::native_get()
void * var
Pointer to the global variable.
int mutt_str_asprintf(char **strp, const char *fmt,...)
Convenience wrapper for the library headers.
#define CSR_INV_VALIDATOR
Value was rejected by the validator.
static int string_native_set(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set a String config item by string - Implements ConfigSetType::native_set()