/[svn]/liblscp/trunk/src/common.c
ViewVC logotype

Diff of /liblscp/trunk/src/common.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 179 by capela, Tue Jul 6 16:24:41 2004 UTC revision 180 by capela, Tue Jul 6 20:20:51 2004 UTC
# Line 223  char *lscp_unquote ( char **ppsz, int du Line 223  char *lscp_unquote ( char **ppsz, int du
223      return psz;      return psz;
224  }  }
225    
226    // Unquote and make a duplicate of an in-split string.
227    void lscp_unquote_dup ( char **ppszDst, char **ppszSrc )
228    {
229         // Free desteny string, if already there.
230         if (*ppszDst)
231             free(*ppszDst);
232         *ppszDst = NULL;
233         // Unquote and duplicate.
234         if (*ppszSrc)
235             *ppszDst = lscp_unquote(ppszSrc, 1);
236    }
237    
238    
239  // Custom tokenizer.  // Custom tokenizer.
240  char *lscp_strtok ( char *pchBuffer, const char *pszSeps, char **ppch )  char *lscp_strtok ( char *pchBuffer, const char *pszSeps, char **ppch )
# Line 556  void lscp_plist_append ( lscp_param_t ** Line 568  void lscp_plist_append ( lscp_param_t **
568            
569      if (ppList && *ppList) {      if (ppList && *ppList) {
570          pParams = *ppList;          pParams = *ppList;
571          while (pParams[i].key)          while (pParams[i].key) {
572                if (strcasecmp(pParams[i].key, pszKey) == 0) {
573                    if (pParams[i].value)
574                        free(pParams[i].value);
575                    pParams[i].value = strdup(pszValue);
576                    return;
577                }
578              i++;              i++;
579            }
580          iSize = LSCP_SPLIT_SIZE(i);          iSize = LSCP_SPLIT_SIZE(i);
581          pParams[i].key   = strdup(pszKey);          pParams[i].key   = strdup(pszKey);
582          pParams[i].value = strdup(pszValue);          pParams[i].value = strdup(pszValue);
# Line 578  void lscp_plist_append ( lscp_param_t ** Line 597  void lscp_plist_append ( lscp_param_t **
597      }      }
598  }  }
599    
600    #ifdef LSCP_PLIST_COUNT
601    
602  // Compute a parameter list valid item count.  // Compute a parameter list valid item count.
603  int lscp_plist_count ( lscp_param_t **ppList )  int lscp_plist_count ( lscp_param_t **ppList )
# Line 592  int lscp_plist_count ( lscp_param_t **pp Line 612  int lscp_plist_count ( lscp_param_t **pp
612      return i;      return i;
613  }  }
614    
   
615  // Compute the legal parameter list size.  // Compute the legal parameter list size.
616  int lscp_plist_size ( lscp_param_t **ppList )  int lscp_plist_size ( lscp_param_t **ppList )
617  {  {
618      return LSCP_SPLIT_SIZE(lscp_plist_count(ppList));      return LSCP_SPLIT_SIZE(lscp_plist_count(ppList));
619  }  }
620    
621    #endif // LSCP_PLIST_COUNT
622    
623    
624  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------

Legend:
Removed from v.179  
changed lines
  Added in v.180

  ViewVC Help
Powered by ViewVC