Append a string to a StringList and return a pointer to the modified * StringList. * * If the input StringList is NULL, then a new StringList is created. * Note that CSLAddString performance when building a list is in O(n^2) * which can cause noticeable slow down when n > 10000. */
| 66 | * which can cause noticeable slow down when n > 10000. |
| 67 | */ |
| 68 | char **CSLAddString(char **papszStrList, const char *pszNewString) |
| 69 | { |
| 70 | char **papszRet = CSLAddStringMayFail(papszStrList, pszNewString); |
| 71 | if (papszRet == nullptr && pszNewString != nullptr) |
| 72 | abort(); |
| 73 | return papszRet; |
| 74 | } |
| 75 | |
| 76 | /** Same as CSLAddString() but may return NULL in case of (memory) failure */ |
| 77 | char **CSLAddStringMayFail(char **papszStrList, const char *pszNewString) |