if (!*qend)
{
/*
- * No closing quote, error out!
+ * No closing quote, error out!
*/
free(s);
free(re);
- if (lword)
- free(lword);
+ free(lword);
return (NULL);
}
*/
if (sptr > s)
- prefix = ".*";
+ prefix = ".*";
qptr = qend;
}
*/
if (sptr > s)
- prefix = ".*|.*";
+ prefix = ".*|.*";
qptr = qend;
}
wlen = (size_t)(sptr - s) + 2 * 4 * wlen + 2 * strlen(prefix) + 11;
if (lword)
- wlen += strlen(lword);
+ wlen += strlen(lword);
if (wlen > slen)
{
free(s);
free(re);
- if (lword)
- free(lword);
+ free(lword);
return (NULL);
}
while (qptr < qend)
{
/*
- * Quote: ^ . [ $ ( ) | * + ? { \
+ * Quote: ^ . [ $ ( ) | * + ? { \
*/
- if (strchr("^.[$()|*+?{\\", *qptr))
+ if (strchr("^.[$()|*+?{\\", *qptr))
*sptr++ = '\\';
*sptr++ = *qptr++;
if (!strcmp(prefix, ".*") && lword)
{
- char *lword2; /* New "last word" */
+ char *lword2; /* New "last word" */
- if ((lword2 = strdup(sword)) == NULL)
+ if ((lword2 = strdup(sword)) == NULL)
{
free(lword);
free(s);
return (NULL);
}
- memcpy(sptr, ".*|.*", 6);
+ memcpy(sptr, ".*|.*", 6);
sptr += 5;
memcpy(sptr, lword2, strlen(lword2) + 1);
sptr += strlen(sptr);
- memcpy(sptr, ".*", 3);
+ memcpy(sptr, ".*", 3);
sptr += 2;
memcpy(sptr, lword, strlen(lword) + 1);
sptr += strlen(sptr);
- free(lword);
+ free(lword);
lword = lword2;
}
else
{
- if (lword)
- free(lword);
+ free(lword);
lword = strdup(sword);
}
qptr ++;
}
- if (lword)
- free(lword);
+ free(lword);
if (sptr > s)
memcpy(sptr, ".*", 3);