added qse_xli_insertpairwithstrs().
renamed qse_xli_getnumpairs() to qse_xli_countpairs(). reworked qse_xli_findpair() and qse_xli_countpairs()
This commit is contained in:
@ -1212,7 +1212,7 @@ static int load_server_config (qse_httpd_t* httpd, qse_httpd_server_t* server, q
|
||||
}
|
||||
|
||||
/* load host/location specific configuration */
|
||||
host_count = qse_xli_getnumpairs (httpd_xtn->xli, list, QSE_T("host"));
|
||||
host_count = qse_xli_countpairs (httpd_xtn->xli, list, QSE_T("host"));
|
||||
if (host_count <= 0) return 0; /* nothing to load */
|
||||
|
||||
QSE_ASSERT (server_xtn->cfgtab == QSE_NULL);
|
||||
@ -1240,7 +1240,7 @@ static int load_server_config (qse_httpd_t* httpd, qse_httpd_server_t* server, q
|
||||
|
||||
if (host->val->type == QSE_XLI_LIST && host->alias)
|
||||
{
|
||||
loc_count = qse_xli_getnumpairs (httpd_xtn->xli, (qse_xli_list_t*)host->val, QSE_T("location"));
|
||||
loc_count = qse_xli_countpairs (httpd_xtn->xli, (qse_xli_list_t*)host->val, QSE_T("location"));
|
||||
|
||||
if (((hostcfg = qse_httpd_callocmem (httpd, QSE_SIZEOF(*hostcfg))) == QSE_NULL) ||
|
||||
((hostcfg->hostname = qse_httpd_strtombsdup (httpd, (host->alias[0] == QSE_T('\0')? QSE_T("*"):host->alias))) == QSE_NULL)) goto oops;
|
||||
|
@ -484,9 +484,31 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
|
||||
goto oops;
|
||||
}
|
||||
|
||||
{
|
||||
static qse_cstr_t strs[] =
|
||||
{
|
||||
{ QSE_T("hello"), 5 },
|
||||
{ QSE_T("xli"), 3 },
|
||||
{ QSE_T("world"), 5 }
|
||||
};
|
||||
|
||||
if (qse_xli_insertpairwithstrs (xli, qse_xli_getroot(xli), QSE_NULL, QSE_T("test-key"), QSE_NULL, strs, QSE_COUNTOF(strs)) == QSE_NULL)
|
||||
{
|
||||
qse_fprintf (QSE_STDERR,
|
||||
QSE_T("ERROR: cannot insert a string pair - %s \n"),
|
||||
qse_xli_geterrmsg(xli)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_lookup_key)
|
||||
{
|
||||
qse_xli_pair_t* pair;
|
||||
qse_size_t count;
|
||||
|
||||
count = qse_xli_countpairs (xli, QSE_NULL, g_lookup_key);
|
||||
qse_printf (QSE_T("COUNT: %lu\n"), (unsigned long)count);
|
||||
|
||||
pair = qse_xli_findpair (xli, QSE_NULL, g_lookup_key);
|
||||
if (pair == QSE_NULL)
|
||||
{
|
||||
|
Reference in New Issue
Block a user