uval->s_cb_func = httpd__match_ref_cb;
uval->s_cb_func = ref->func; ref->func = httpd__match_ref_cb;
static int httpd__match_make(Conf_parse *conf, Conf_token *token,                             unsigned int type,                             Conf_token *beg, Conf_token *end){  unsigned int outer_depth = token->depth_num;  int ret = FALSE;  Vstr_ref *ref  = NULL;  Conf_token token_srch_tmp = CONF_TOKEN_INIT;  Conf_token save = CONF_TOKEN_INIT;  Conf_token *add_beg = end;  Httpd__match_uval *uval = NULL;  int auto_reclaim_ref = FALSE;    ASSERT(beg && end && (!beg->num == !end->num));    if (!conf_token_set_user_value(conf, token, type, NULL, 0))    return (FALSE);  if (!(ref = vstr_ref_make_malloc(sizeof(Httpd__match_uval))))    return (FALSE);  uval = ref->ptr;    uval->name = NULL;  uval->s_cb_func = httpd__match_ref_cb;  uval->opt_nxt = save = *token;  ret = conf_token_set_user_value(conf, &save, type, ref, 0);  ASSERT(ret);  vstr_ref_del(ref); /* going to use uval/ref later, but that's OK */      CONF_SC_PARSE_TOP_TOKEN_RET(conf, token, FALSE);  if (token->type != CONF_TOKEN_TYPE_SLIST)  {    int clist_name = FALSE;    int clist_xtra = FALSE;    unsigned int inner_depth = 0;    const Vstr_sect_node *pv = NULL;        CONF_SC_TOGGLE_CLIST_VAR(clist_name);    if (token->type == CONF_TOKEN_TYPE_CLIST)      goto skip_name;        if (!(pv = conf_token_value(token)))      return (FALSE);        if (!(uval->name = vstr_make_base(conf->tmp->conf)))      return (FALSE);    if (!vstr_add_vstr(uval->name, 0,                       conf->data, pv->pos, pv->len, VSTR_TYPE_ADD_BUF_REF))      return (FALSE);   skip_name:    inner_depth = token->depth_num;    CONF_SC_MAKE_CLIST_MID(inner_depth, clist_xtra);    else if (token->type == CONF_TOKEN_TYPE_SLIST)      goto skip_position;    else if (OPT_SERV_SYM_EQ("after")  && beg->num)    {      OPT_SERV_X_VSTR(conf->tmp);      token_srch_tmp = *beg;      add_beg = &token_srch_tmp;      if (!httpd__match_find(conf, &add_beg))        return (FALSE);    }    else if (OPT_SERV_SYM_EQ("before") && beg->num)    {      OPT_SERV_X_VSTR(conf->tmp);      token_srch_tmp = *beg;      add_beg = &token_srch_tmp;      if (!httpd__match_find_before(conf, &add_beg))        return (FALSE);    }    else if (OPT_SERV_SYM_EQ("end"))      add_beg = end;    else if (OPT_SERV_SYM_EQ("beg") || OPT_SERV_SYM_EQ("beginning"))      add_beg = NULL;    else if (OPT_SERV_SYM_EQ("<reclaim-memory>"))      OPT_SERV_X_TOGGLE(auto_reclaim_ref);          CONF_SC_MAKE_CLIST_END();        CONF_SC_PARSE_SLIST_DEPTH_TOKEN_RET(conf, token, outer_depth, FALSE);  } skip_position:  if ((token->type != CONF_TOKEN_TYPE_SLIST) ||      (conf_token_at_depth(token) != outer_depth))    return (FALSE);  ASSERT(ref);  if (auto_reclaim_ref && !uval->name)    ref = NULL;    if (!beg->num)  {    ret = conf_token_set_user_value(conf, &save, type, ref, 0);    ASSERT(ret);        *beg = save;    *end = save;  }  else if (!add_beg) /* put before beg */  {    ret = conf_token_set_user_value(conf, &save, type, ref, beg->num);    ASSERT(ret);    *beg = save;  }  else  {    Vstr_ref *oref = NULL;    unsigned int nxt = 0;    ASSERT(add_beg && ((add_beg->type - CONF_TOKEN_TYPE_USER_BEG) == type));    ASSERT(add_beg->num != 0);    oref = conf_token_get_user_value(conf, add_beg, &nxt);    ASSERT(oref);    ret = conf_token_set_user_value(conf, &save, type, ref, nxt);    ASSERT(ret);    ret = conf_token_set_user_value(conf, add_beg, type, oref, save.num);    ASSERT(ret);    if (!nxt) /* put after end */    {      ASSERT(add_beg->num == end->num);      *end = save;    }        vstr_ref_del(oref);  }    return (TRUE);}