70 mbstate_t mbstate = { 0 };
86 while (slen && (k = mbrtowc(NULL, s, slen, &mbstate)))
93 memset(&mbstate, 0,
sizeof(mbstate));
123 const char *value,
struct Buffer *err)
126 if (value && (value[0] ==
'\0'))
146 rc = cdef->
validator(cs, cdef, (intptr_t) table, err);
157 *(
struct MbTable **) var = table;
180 const char *str = NULL;
217 const struct ConfigDef *cdef, intptr_t value,
230 rc = cdef->
validator(cs, cdef, value, err);
244 *(
struct MbTable **) var = table;
256 return (intptr_t) table;
266 const char *initial = (
const char *) cdef->
initial;
269 const char *curval = curtable ? curtable->
orig_str : NULL;
286 rc = cdef->
validator(cs, cdef, (intptr_t) table, err);
300 *(
struct MbTable **) var = table;
333 if (!table || !table->
chars || (index < 0) || (index >= table->
len))
336 if (table->
chars[index][0] ==
'\r')
339 return table->
chars[index];
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
static bool startup_only(const struct ConfigDef *cdef, struct Buffer *err)
Validator function for D_ON_STARTUP.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSR_INV_VALIDATOR
Value was rejected by the validator.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
#define CSR_SUC_EMPTY
Value is empty/unset.
#define CSR_SUCCESS
Action completed successfully.
static void mbtable_destroy(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef)
Destroy an MbTable object - Implements ConfigSetType::destroy() -.
static intptr_t mbtable_native_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get an MbTable object from a MbTable config item - Implements ConfigSetType::native_get() -.
static int mbtable_native_set(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set an MbTable config item by MbTable object - Implements ConfigSetType::native_set() -.
static int mbtable_reset(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset an MbTable to its initial value - Implements ConfigSetType::reset() -.
static int mbtable_string_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a MbTable as a string - Implements ConfigSetType::string_get() -.
static int mbtable_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set an MbTable by string - Implements ConfigSetType::string_set() -.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG1
Log at debug level 1.
bool mbtable_equal(const struct MbTable *a, const struct MbTable *b)
Compare two MbTables.
static struct MbTable * mbtable_dup(struct MbTable *table)
Create a copy of an MbTable object.
struct MbTable * mbtable_parse(const char *s)
Parse a multibyte string into a table.
const char * mbtable_get_nth_wchar(const struct MbTable *table, int index)
Extract one char from a multi-byte table.
void mbtable_free(struct MbTable **ptr)
Free an MbTable object.
const struct ConfigSetType CstMbtable
Config type representing a multi-byte table.
Type representing a multibyte character table.
#define MUTT_MEM_CALLOC(n, type)
#define ICONV_BUF_TOO_SMALL
Error value for iconv() - Buffer too small.
#define ICONV_ILLEGAL_SEQ
Error value for iconv() - Illegal sequence.
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
String manipulation buffer.
int(* validator)(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
intptr_t initial
Initial value.
uint32_t type
Variable type, e.g. DT_STRING.
Container for lots of config items.
Multibyte character table.
char * orig_str
Original string used to generate this object.
int len
Number of characters.
char ** chars
The array of multibyte character strings.
char * segmented_str
Each chars entry points inside this string.
Constants for all the config types.
#define D_INTERNAL_INITIAL_SET
Config item must have its initial value freed.
@ DT_MBTABLE
multibyte char table