int vstr_sects_update_del(const Vstr_base *base, Vstr_sects *sects) { Vstr__sects_cache_data *data = NULL; Vstr_sects **srch = NULL; if (!sects) return (FALSE); ASSERT_RET(base->conf->cache_pos_cb_sects, FALSE); data = vstr_cache_get(base, base->conf->cache_pos_cb_sects); ASSERT_RET(data, FALSE); srch = vstr__sects_update_srch(data, sects); ASSERT_RET(srch, FALSE); vstr__sects_update_del(data, srch); if (!data->len) { VSTR__F(data); vstr_cache_set(base, base->conf->cache_pos_cb_sects, NULL); } return (TRUE); }
size_t vstr_cspn_bmap_and_rev(const Vstr_base *base, size_t pos, size_t len, const unsigned char bmap[VSTR__COMPILE_STATIC_ARRAY() 256], unsigned char val) { Vstr_iter iter[1]; size_t ret = 0; ASSERT_RET(base, 0); if (!vstr_iter_fwd_beg(base, pos, len, iter)) return (0); do { size_t count = 0; if (iter->node->type == VSTR_TYPE_NODE_NON) goto next_loop_all_good; count = iter->len; while (count-- > 0) if (bmap[0xFF & (unsigned char)iter->ptr[count]] & val) { ret = ((iter->len - count) - 1); goto next_loop_bmap_fail; } next_loop_all_good: ret += iter->len; next_loop_bmap_fail: continue; } while (vstr_iter_fwd_nxt(iter)); return (ret); }
static struct SH_UTMP_S * sh_utmp_getutent(void) { size_t in; static struct SH_UTMP_S out; SL_ENTER(_("sh_utmp_getutent")); ASSERT_RET((sh_utmpfile != NULL), _("sh_utmpfile != NULL"), (NULL)) in = fread (&out, sizeof(struct SH_UTMP_S), 1, sh_utmpfile); if (in != 1) { if (ferror (sh_utmpfile) != 0) { clearerr (sh_utmpfile); SL_RETURN(NULL, _("sh_utmp_getutent")); } else { SL_RETURN(NULL, _("sh_utmp_getutent")); } } SL_RETURN(&out, _("sh_utmp_getutent")); }
size_t vstr_cspn_bmap_and_fwd(const Vstr_base *base, size_t pos, size_t len, const unsigned char bmap[VSTR__COMPILE_STATIC_ARRAY() 256], unsigned char val) { Vstr_iter iter[1]; size_t ret = 0; ASSERT_RET(base, 0); if (!vstr_iter_fwd_beg(base, pos, len, iter)) return (0); do { size_t count = 0; if (iter->node->type == VSTR_TYPE_NODE_NON) goto next_loop_all_good; while (count < iter->len) { if (bmap[0xFF & (unsigned char)iter->ptr[count]] & val) return (ret + count); ++count; } assert(count == iter->len); next_loop_all_good: ret += iter->len; } while (vstr_iter_fwd_nxt(iter)); return (ret); }
int vstr_sects_del(Vstr_sects *sects, unsigned int num) { ASSERT_RET((sects->sz && num), FALSE); ASSERT_RET((sects->num >= num), FALSE); if (!sects->ptr[num - 1].pos) return (FALSE); sects->ptr[num - 1].pos = 0; while (sects->num && !sects->ptr[sects->num - 1].pos) --sects->num; if (sects->can_del_sz && (sects->num < (sects->sz / 2))) vstr__sects_del(sects); /* can't return this error */ return (TRUE); }
size_t vstr_spn_chrs_rev(const Vstr_base *base, size_t pos, size_t len, const char *spn_chrs, size_t spn_len) { ASSERT_RET(base, 0); if (base->iovec_upto_date) return (vstr__spn_chrs_rev_fast(base, pos, len, spn_chrs, spn_len)); return (vstr__spn_chrs_rev_slow(base, pos, len, spn_chrs, spn_len)); }
size_t vstr_cspn_chrs_fwd(const Vstr_base *base, size_t pos, size_t len, const char *cspn_chrs, size_t cspn_len) { Vstr_iter iter[1]; size_t ret = 0; ASSERT_RET(base, 0); if (!cspn_chrs && !base->node_non_used) return (len); if (cspn_chrs && (cspn_len == 1)) { size_t f_pos = vstr_srch_chr_fwd(base, pos, len, cspn_chrs[0]); if (!f_pos) return (len); return (f_pos - pos); } if (!vstr_iter_fwd_beg(base, pos, len, iter)) return (0); do { size_t count = 0; if ((iter->node->type == VSTR_TYPE_NODE_NON) && cspn_chrs) goto next_loop; if (iter->node->type == VSTR_TYPE_NODE_NON) { assert(!cspn_chrs); return (ret); } if (!cspn_chrs) goto next_loop; while (count < iter->len) { if (vstr_wrap_memchr(cspn_chrs, iter->ptr[count], cspn_len)) return (ret + count); ++count; } assert(count == iter->len); next_loop: ret += iter->len; } while (vstr_iter_fwd_nxt(iter)); return (ret); }
/*@ckcpuv*/ conn_t * conn_new(network_t * network) { conn_t * thiz = malloc(sizeof(conn_t)); ASSERT_RET(NULL != thiz, "malloc failed", NULL); thiz->_network = network; thiz->_conv = 0; thiz->_udp = NULL; thiz->_kcp = NULL; return thiz; }
size_t vstr_cspn_chrs_rev(const Vstr_base *base, size_t pos, size_t len, const char *cspn_chrs, size_t cspn_len) { ASSERT_RET(base, 0); if (!cspn_chrs && !base->node_non_used) return (len); if (cspn_chrs && (cspn_len == 1)) { size_t f_pos = vstr_srch_chr_rev(base, pos, len, cspn_chrs[0]); if (!f_pos) return (len); return ((pos + (len - 1)) - f_pos); } if (base->iovec_upto_date) return (vstr__cspn_chrs_rev_fast(base, pos, len, cspn_chrs, cspn_len)); return (vstr__cspn_chrs_rev_slow(base, pos, len, cspn_chrs, cspn_len)); }
int vstr_sects_update_add(const Vstr_base *base, Vstr_sects *sects) { Vstr__sects_cache_data *data = NULL; unsigned int sz = 1; if (!base->conf->cache_pos_cb_sects) { unsigned int tmp = 0; tmp = vstr_cache_add(base->conf, "/vstr__/sects/update", vstr__sects_update_cb); if (!tmp) goto malloc_bad; base->conf->cache_pos_cb_sects = tmp; } if (!(data = vstr_cache_get(base, base->conf->cache_pos_cb_sects))) { if (!vstr_cache_set(base, base->conf->cache_pos_cb_sects, NULL)) goto malloc_bad; data = VSTR__MK(sizeof(Vstr__sects_cache_data) + (sz * sizeof(Vstr_sects *))); if (!data) goto malloc_bad; data->sz = 1; data->len = 0; vstr_cache_set(base, base->conf->cache_pos_cb_sects, data); } /* it can't be valid to have the same sects twice */ ASSERT(!vstr__sects_update_srch(data, sects)); sz = data->len + 1; /* this is basically impossible to test (size overflow)... * done this way for coverage */ ASSERT_RET((sz > data->len) || !(base->conf->malloc_bad = TRUE), FALSE); ASSERT(data->sz); ASSERT(data->len <= data->sz); if (data->len >= data->sz) { Vstr__sects_cache_data *tmp_data = NULL; if (!(VSTR__MV(data, tmp_data, sizeof(Vstr__sects_cache_data) + (sz * sizeof(Vstr_sects *))))) goto malloc_bad; data->sz = data->len + 1; vstr_cache_set(base, base->conf->cache_pos_cb_sects, data); } data->updates[data->len] = sects; ++data->len; return (TRUE); malloc_bad: base->conf->malloc_bad = TRUE; return (FALSE); }
int vstr_cntl_conf(Vstr_conf *passed_conf, int option, ...) { Vstr_conf *conf = passed_conf ? passed_conf : vstr__options.def; int ret = 0; va_list ap; assert(conf->user_ref <= conf->ref); va_start(ap, option); switch (option) { case VSTR_CNTL_CONF_GET_NUM_REF: { int *val = va_arg(ap, int *); *val = conf->ref; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_NUM_IOV_MIN_ALLOC: { int *val = va_arg(ap, int *); *val = conf->iov_min_alloc; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_NUM_IOV_MIN_ALLOC: { int val = va_arg(ap, int); conf->iov_min_alloc = val; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_NUM_IOV_MIN_OFFSET: { int *val = va_arg(ap, int *); *val = conf->iov_min_offset; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_NUM_IOV_MIN_OFFSET: { int val = va_arg(ap, int); conf->iov_min_offset = val; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_NUM_BUF_SZ: { unsigned int *val = va_arg(ap, unsigned int *); *val = conf->buf_sz; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_NUM_BUF_SZ: { unsigned int val = va_arg(ap, unsigned int); if (val > VSTR_MAX_NODE_BUF) val = VSTR_MAX_NODE_BUF; /* this is too restrictive, but getting it "right" would require too much * bookkeeping. */ if (!conf->spare_buf_num && (conf->user_ref == conf->ref)) { conf->buf_sz = val; ret = TRUE; } } break; case VSTR_CNTL_CONF_SET_LOC_CSTR_AUTO_NAME_NUMERIC: { const char *val = va_arg(ap, const char *); ret = vstr__make_conf_loc_numeric(conf, val); } break; case VSTR_CNTL_CONF_GET_LOC_CSTR_NAME_NUMERIC: { const char **val = va_arg(ap, const char **); *val = conf->loc->name_lc_numeric_ref->ptr; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_CSTR_NAME_NUMERIC: { const char *val = va_arg(ap, const char *); Vstr_ref *tmp = NULL; if (!(tmp = vstr_ref_make_strdup(val))) break; vstr_ref_del(conf->loc->name_lc_numeric_ref); conf->loc->name_lc_numeric_ref = tmp; conf->loc->name_lc_numeric_len = strlen(tmp->ptr); ret = TRUE; } break; case VSTR_CNTL_CONF_GET_LOC_CSTR_DEC_POINT: { const char **val = va_arg(ap, const char **); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, 0, FALSE); *val = srch->decimal_point_ref->ptr; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_CSTR_DEC_POINT: { const char *val = va_arg(ap, const char *); Vstr_ref *tmp = NULL; Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, 0, FALSE); if (!(tmp = vstr_ref_make_strdup(val))) break; vstr_ref_del(srch->decimal_point_ref); srch->decimal_point_ref = tmp; srch->decimal_point_len = strlen(tmp->ptr); ret = TRUE; } break; case VSTR_CNTL_CONF_GET_LOC_CSTR_THOU_SEP: { const char **val = va_arg(ap, const char **); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, 0, FALSE); *val = srch->thousands_sep_ref->ptr; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_CSTR_THOU_SEP: { const char *val = va_arg(ap, const char *); Vstr_ref *tmp = NULL; Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, 0, FALSE); if (!(tmp = vstr_ref_make_strdup(val))) break; vstr_ref_del(srch->thousands_sep_ref); srch->thousands_sep_ref = tmp; srch->thousands_sep_len = strlen(tmp->ptr); ret = TRUE; } break; case VSTR_CNTL_CONF_GET_LOC_CSTR_THOU_GRP: { const char **val = va_arg(ap, const char **); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, 0, FALSE); *val = srch->grouping->ptr; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_CSTR_THOU_GRP: { const char *val = va_arg(ap, const char *); Vstr_ref *tmp = NULL; size_t len = vstr__loc_thou_grp_strlen(val); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, 0, FALSE); if (!(tmp = vstr_ref_make_malloc(len + 1))) break; vstr_ref_del(srch->grouping); if (len) vstr_wrap_memcpy(tmp->ptr, val, len); ((char *)tmp->ptr)[len] = 0; srch->grouping = tmp; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_FLAG_IOV_UPDATE: { int *val = va_arg(ap, int *); *val = conf->iovec_auto_update; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_FLAG_IOV_UPDATE: { int val = va_arg(ap, int); assert(val == !!val); conf->iovec_auto_update = val; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_FLAG_DEL_SPLIT: { int *val = va_arg(ap, int *); *val = conf->split_buf_del; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_FLAG_DEL_SPLIT: { int val = va_arg(ap, int); assert(val == !!val); conf->split_buf_del = val; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_FLAG_ALLOC_CACHE: { int *val = va_arg(ap, int *); *val = !conf->no_cache; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_FLAG_ALLOC_CACHE: { int val = va_arg(ap, int); assert(val == !!val); ret = TRUE; if (conf->no_cache == !val) break; vstr__del_grpalloc(conf, conf->spare_base_num); conf->no_cache = !val; if (conf->no_cache) conf->grpalloc_cache = VSTR_TYPE_CNTL_CONF_GRPALLOC_NONE; else conf->grpalloc_cache = VSTR_TYPE_CNTL_CONF_GRPALLOC_POS; } break; case VSTR_CNTL_CONF_GET_FMT_CHAR_ESC: { char *val = va_arg(ap, char *); *val = conf->fmt_usr_escape; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_FMT_CHAR_ESC: { int val = va_arg(ap, int); conf->fmt_usr_escape = val; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_NUM_SPARE_BUF: case VSTR_CNTL_CONF_GET_NUM_SPARE_NON: case VSTR_CNTL_CONF_GET_NUM_SPARE_PTR: case VSTR_CNTL_CONF_GET_NUM_SPARE_REF: { unsigned int *val = va_arg(ap, unsigned int *); switch (option) { case VSTR_CNTL_CONF_GET_NUM_SPARE_BUF: *val= conf->spare_buf_num; break; case VSTR_CNTL_CONF_GET_NUM_SPARE_NON: *val= conf->spare_non_num; break; case VSTR_CNTL_CONF_GET_NUM_SPARE_PTR: *val= conf->spare_ptr_num; break; case VSTR_CNTL_CONF_GET_NUM_SPARE_REF: *val= conf->spare_ref_num; break; } ret = TRUE; } break; case VSTR_CNTL_CONF_SET_NUM_SPARE_BUF: case VSTR_CNTL_CONF_SET_NUM_SPARE_NON: case VSTR_CNTL_CONF_SET_NUM_SPARE_PTR: case VSTR_CNTL_CONF_SET_NUM_SPARE_REF: { unsigned int val = va_arg(ap, unsigned int); unsigned int type = 0; unsigned int spare_num = 0; switch (option) { case VSTR_CNTL_CONF_SET_NUM_SPARE_BUF: type = VSTR_TYPE_NODE_BUF; spare_num = conf->spare_buf_num; break; case VSTR_CNTL_CONF_SET_NUM_SPARE_NON: type = VSTR_TYPE_NODE_NON; spare_num = conf->spare_non_num; break; case VSTR_CNTL_CONF_SET_NUM_SPARE_PTR: type = VSTR_TYPE_NODE_PTR; spare_num = conf->spare_ptr_num; break; case VSTR_CNTL_CONF_SET_NUM_SPARE_REF: type = VSTR_TYPE_NODE_REF; spare_num = conf->spare_ref_num; break; } if (val == spare_num) { /* do nothing */ } else if (val > spare_num) { unsigned int num = 0; num = vstr_make_spare_nodes(conf, type, val - spare_num); if (num != (val - spare_num)) { assert(ret == FALSE); break; } } else if (val < spare_num) { unsigned int num = 0; num = vstr_free_spare_nodes(conf, type, spare_num - val); ASSERT(num == (spare_num - val)); } ret = TRUE; } break; case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_BUF: case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_NON: case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_PTR: case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_REF: { unsigned int val_min = va_arg(ap, unsigned int); unsigned int val_max = va_arg(ap, unsigned int); unsigned int type = 0; unsigned int spare_num = 0; ASSERT(val_min <= val_max); switch (option) { case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_BUF: type = VSTR_CNTL_CONF_SET_NUM_SPARE_BUF; spare_num = conf->spare_buf_num; break; case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_NON: type = VSTR_CNTL_CONF_SET_NUM_SPARE_NON; spare_num = conf->spare_non_num; break; case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_PTR: type = VSTR_CNTL_CONF_SET_NUM_SPARE_PTR; spare_num = conf->spare_ptr_num; break; case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_REF: type = VSTR_CNTL_CONF_SET_NUM_SPARE_REF; spare_num = conf->spare_ref_num; ASSERT_NO_SWITCH_DEF(); } if (0) { ASSERT(FALSE); } else if (val_min > spare_num) return (vstr_cntl_conf(conf, type, val_min)); else if (val_max < spare_num) return (vstr_cntl_conf(conf, type, val_max)); ret = TRUE; } break; case VSTR_CNTL_CONF_GET_FLAG_ATOMIC_OPS: { int *val = va_arg(ap, int *); *val = conf->atomic_ops; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_FLAG_ATOMIC_OPS: { int val = va_arg(ap, int); assert(val == !!val); conf->atomic_ops = val; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_TYPE_GRPALLOC_CACHE: { unsigned int *val = va_arg(ap, unsigned int *); *val = conf->grpalloc_cache; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_TYPE_GRPALLOC_CACHE: { unsigned int val = va_arg(ap, unsigned int); ASSERT_RET(((val == VSTR_TYPE_CNTL_CONF_GRPALLOC_NONE) || (val == VSTR_TYPE_CNTL_CONF_GRPALLOC_POS) || (val == VSTR_TYPE_CNTL_CONF_GRPALLOC_IOVEC) || (val == VSTR_TYPE_CNTL_CONF_GRPALLOC_CSTR) || FALSE), FALSE); ret = TRUE; if (conf->grpalloc_cache == val) break; vstr__del_grpalloc(conf, conf->spare_base_num); conf->grpalloc_cache = val; if (val == VSTR_TYPE_CNTL_CONF_GRPALLOC_NONE) conf->no_cache = TRUE; else conf->no_cache = FALSE; } break; case VSTR_CNTL_CONF_GET_NUM_SPARE_BASE: { unsigned int *val = va_arg(ap, unsigned int *); *val = conf->spare_base_num; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_NUM_SPARE_BASE: { unsigned int val = va_arg(ap, unsigned int); unsigned int spare_num = conf->spare_base_num; if (val == spare_num) { /* do nothing */ } else if (val > spare_num) { Vstr_base *tmp = NULL; Vstr_base *old_beg = NULL; unsigned int old_num = 0; while (conf->spare_base_num < val) { old_beg = conf->spare_base_beg; old_num = conf->spare_base_num; conf->spare_base_beg = NULL; conf->spare_base_num = 0; tmp = vstr_make_base(conf); conf->spare_base_beg = old_beg; conf->spare_base_num = old_num; if (!tmp) return (FALSE); vstr_free_base(tmp); } } else if (val < spare_num) vstr__del_grpalloc(conf, spare_num - val); ret = TRUE; } break; case VSTR_CNTL_CONF_SET_NUM_RANGE_SPARE_BASE: { unsigned int val_min = va_arg(ap, unsigned int); unsigned int val_max = va_arg(ap, unsigned int); unsigned int spare_num = conf->spare_base_num; ASSERT(val_min <= val_max); if (0) { ASSERT(FALSE); } else if (val_min > spare_num) return (vstr_cntl_conf(conf, VSTR_CNTL_CONF_SET_NUM_SPARE_BASE, val_min)); else if (val_max < spare_num) return (vstr_cntl_conf(conf, VSTR_CNTL_CONF_SET_NUM_SPARE_BASE, val_max)); ret = TRUE; } break; case VSTR_CNTL_CONF_GET_LOC_REF_NAME_NUMERIC: { Vstr_ref **val_ref = va_arg(ap, Vstr_ref **); size_t *val_len = va_arg(ap, size_t *); *val_ref = vstr_ref_add(conf->loc->name_lc_numeric_ref); *val_len = conf->loc->name_lc_numeric_len; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_REF_NAME_NUMERIC: { Vstr_ref *tmp = va_arg(ap, Vstr_ref *); size_t len = va_arg(ap, size_t); vstr_ref_del(conf->loc->name_lc_numeric_ref); conf->loc->name_lc_numeric_ref = vstr_ref_add(tmp); conf->loc->name_lc_numeric_len = len; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_LOC_REF_DEC_POINT: { unsigned int nb = va_arg(ap, unsigned int); Vstr_ref **val_ref = va_arg(ap, Vstr_ref **); size_t *val_len = va_arg(ap, size_t *); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, nb, FALSE); *val_ref = vstr_ref_add(srch->decimal_point_ref); *val_len = srch->decimal_point_len; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_REF_DEC_POINT: { unsigned int nb = va_arg(ap, unsigned int); Vstr_ref *tmp = va_arg(ap, Vstr_ref *); size_t len = va_arg(ap, size_t); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, nb, TRUE); if (!srch) break; vstr_ref_del(srch->decimal_point_ref); srch->decimal_point_ref = vstr_ref_add(tmp); srch->decimal_point_len = len; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_LOC_REF_THOU_SEP: { unsigned int nb = va_arg(ap, unsigned int); Vstr_ref **val_ref = va_arg(ap, Vstr_ref **); size_t *val_len = va_arg(ap, size_t *); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, nb, FALSE); *val_ref = vstr_ref_add(srch->thousands_sep_ref); *val_len = srch->thousands_sep_len; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_REF_THOU_SEP: { unsigned int nb = va_arg(ap, unsigned int); Vstr_ref *tmp = va_arg(ap, Vstr_ref *); size_t len = va_arg(ap, size_t); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, nb, TRUE); if (!srch) break; vstr_ref_del(srch->thousands_sep_ref); srch->thousands_sep_ref = vstr_ref_add(tmp); srch->thousands_sep_len = len; ret = TRUE; } break; case VSTR_CNTL_CONF_GET_LOC_REF_THOU_GRP: { unsigned int nb = va_arg(ap, unsigned int); Vstr_ref **val_ref = va_arg(ap, Vstr_ref **); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, nb, FALSE); *val_ref = vstr_ref_add(srch->grouping); ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_REF_THOU_GRP: { unsigned int nb = va_arg(ap, unsigned int); Vstr_ref *tmp = va_arg(ap, Vstr_ref *); Vstr_locale_num_base *srch = vstr__loc_num_srch(conf->loc, nb, TRUE); if (!srch) break; vstr_ref_del(srch->grouping); srch->grouping = vstr_ref_add(tmp); ret = TRUE; } break; case VSTR_CNTL_CONF_GET_LOC_REF_NULL_PTR: { Vstr_ref **val_ref = va_arg(ap, Vstr_ref **); size_t *val_len = va_arg(ap, size_t *); *val_ref = vstr_ref_add(conf->loc->null_ref); *val_len = conf->loc->null_len; ret = TRUE; } break; case VSTR_CNTL_CONF_SET_LOC_REF_NULL_PTR: { Vstr_ref *tmp = va_arg(ap, Vstr_ref *); size_t len = va_arg(ap, size_t); vstr_ref_del(conf->loc->null_ref); conf->loc->null_ref = vstr_ref_add(tmp); conf->loc->null_len = len; ret = TRUE; } /* break in assert */ ASSERT_NO_SWITCH_DEF(); } va_end(ap); return (ret); }