e310cad5467b2f306c8f90b23f749ad9f6a43296 hiram Sat May 25 09:47:39 2019 -0700 clean up argList processing code review refs #23521 #23427 diff --git src/hg/hubApi/apiUtils.c src/hg/hubApi/apiUtils.c index d758bbf..f3a4887 100644 --- src/hg/hubApi/apiUtils.c +++ src/hg/hubApi/apiUtils.c @@ -375,42 +375,44 @@ struct trackHubGenome *findHubGenome(struct trackHub *hub, char *genome, char *endpoint, char *hubUrl) /* given open 'hub', find the specified 'genome' called from 'endpoint' */ { struct trackHubGenome *hubGenome = NULL; for (hubGenome = hub->genomeList; hubGenome; hubGenome = hubGenome->next) { if (sameString(genome, hubGenome->name)) break; } if (NULL == hubGenome) apiErrAbort(err400, err400Msg, "failed to find specified genome=%s for endpoint '%s' given hubUrl '%s'", genome, endpoint, hubUrl); return hubGenome; } -char *verifyLegalArgs(char *validArgList) -/* validArgList is a semicolon;separated;list;of;valid;arguments +char *verifyLegalArgs(char *validArgList[]) +/* validArgList is an array of strings for valid arguments * returning string of any other arguments not on that list found in * cgiVarList(), NULL when none found. */ { struct hash *validHash = NULL; char *words[32]; int wordCount = 0; -if (isNotEmpty(validArgList)) +int i = 0; +for ( ; isNotEmpty(validArgList[i]); ++i ) { - wordCount = chopByChar(cloneString(validArgList), ';', words, 32); + ++wordCount; + words[i] = validArgList[i]; } if (wordCount) { validHash = hashNew(0); int i; for (i = 0; i < wordCount; ++i) hashAddInt(validHash, words[i], 1); } int extrasFound = 0; struct dyString *extras = newDyString(128); struct cgiVar *varList = cgiVarList(); struct cgiVar *var = varList; for ( ; var; var = var->next)