if (!(r = new(char*, strv_length(l)+1)))
return NULL;
- for (k = r; *l; k++, l++)
- if (!(*k = strdup(*l)))
- goto fail;
+ if (l)
+ for (k = r; *l; k++, l++)
+ if (!(*k = strdup(*l)))
+ goto fail;
*k = NULL;
return r;
if (!l)
return NULL;
- /* Drops every occurrence of s in the string list */
+ assert(s);
+
+ /* Drops every occurrence of s in the string list, edits
+ * in-place. */
for (f = t = l; *f; f++) {
for (; *a; a++) {
char **j;
- size_t n = strcspn(*a, "=") + 1;
+ size_t n;
+
+ n = strcspn(*a, "=");
+
+ if ((*a)[n] == '=')
+ n++;
for (j = r; j < *k; j++)
if (strncmp(*j, *a, n) == 0)