ed4a1bedfe459ab472a17e654161777bd9bb0a20 kent Wed Dec 11 17:00:05 2013 -0800 Adding cgiDictionaryFreeList function. diff --git src/lib/cheapcgi.c src/lib/cheapcgi.c index 1ba081e..d10ecfc 100644 --- src/lib/cheapcgi.c +++ src/lib/cheapcgi.c @@ -611,30 +611,44 @@ } void cgiDictionaryFree(struct cgiDictionary **pD) /* Free up resources associated with dictionary. */ { struct cgiDictionary *d = *pD; if (d != NULL) { slFreeList(&d->list); hashFree(&d->hash); freez(&d->stringData); freez(pD); } } +void cgiDictionaryFreeList(struct cgiDictionary **pList) +/* Free up a whole list of cgiDictionaries */ +{ +struct cgiDictionary *el, *next; + +for (el = *pList; el != NULL; el = next) + { + next = el->next; + cgiDictionaryFree(&el); + } +*pList = NULL; +} + + void cgiParseInputAbort(char *input, struct hash **retHash, struct cgiVar **retList) /* Parse cgi-style input into a hash table and list. This will alter * the input data. The hash table will contain references back * into input, so please don't free input until you're done with * the hash. Prints message aborts if there's an error. * To clean up - slFreeList, hashFree, and only then free input. */ { char *namePt, *dataPt, *nextNamePt; struct hash *hash = *retHash; struct cgiVar *list = *retList, *el; if (!hash) hash = newHash(6); slReverse(&list);