--- liblscp/trunk/src/common.c 2004/07/06 16:24:41 179 +++ liblscp/trunk/src/common.c 2004/07/06 20:20:51 180 @@ -223,6 +223,18 @@ return psz; } +// Unquote and make a duplicate of an in-split string. +void lscp_unquote_dup ( char **ppszDst, char **ppszSrc ) +{ + // Free desteny string, if already there. + if (*ppszDst) + free(*ppszDst); + *ppszDst = NULL; + // Unquote and duplicate. + if (*ppszSrc) + *ppszDst = lscp_unquote(ppszSrc, 1); +} + // Custom tokenizer. char *lscp_strtok ( char *pchBuffer, const char *pszSeps, char **ppch ) @@ -556,8 +568,15 @@ if (ppList && *ppList) { pParams = *ppList; - while (pParams[i].key) + while (pParams[i].key) { + if (strcasecmp(pParams[i].key, pszKey) == 0) { + if (pParams[i].value) + free(pParams[i].value); + pParams[i].value = strdup(pszValue); + return; + } i++; + } iSize = LSCP_SPLIT_SIZE(i); pParams[i].key = strdup(pszKey); pParams[i].value = strdup(pszValue); @@ -578,6 +597,7 @@ } } +#ifdef LSCP_PLIST_COUNT // Compute a parameter list valid item count. int lscp_plist_count ( lscp_param_t **ppList ) @@ -592,13 +612,13 @@ return i; } - // Compute the legal parameter list size. int lscp_plist_size ( lscp_param_t **ppList ) { return LSCP_SPLIT_SIZE(lscp_plist_count(ppList)); } +#endif // LSCP_PLIST_COUNT //-------------------------------------------------------------------------