And fix the documentation.
* string which may contain a single string conversion specifier which gets
* replaced by 'arg'.
*
- * \return A string in which all matches in \a src are replaced, or NULL if \a
- * macro_name was not found in \a src. Caller must free the result.
+ * \return A string in which all matches in \a src are replaced, or NULL if an
+ * syntax error was encountered. Caller must free the result.
*
* \sa regcomp(3)
*/
while (mp->name) {
ret = s_a_r(tmp, mp->name, mp->replacement);
free(tmp);
- if (!ret)
- return src; /* FIXME: shouldn't we continue here? */
+ if (!ret) /* syntax error */
+ return NULL;
tmp = ret;
mp++;
}