X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=mysql_selector.c;h=46fc65b88b432bdba89fa6b892b3c180ba720a0e;hb=f63aa66c5655ca9f9a881c0988c90ed135515c19;hp=07cbfc65878bfc43ca4bb1fb90c4fa3a216b0536;hpb=01965c9b51d8850aa27b23dd098346cf2d29b76f;p=paraslash.git diff --git a/mysql_selector.c b/mysql_selector.c index 07cbfc65..46fc65b8 100644 --- a/mysql_selector.c +++ b/mysql_selector.c @@ -13,7 +13,7 @@ #include "server.cmdline.h" #include "server.h" #include "vss.h" -#include "afs.h" +#include "afs_common.h" #include #include #include @@ -67,11 +67,11 @@ static const struct para_macro mysql_macro_list[] = { }; /** - * simple search and replace routine + * Simple search and replace routine. * - * \param src source string - * \param macro_name the name of the macro - * \param replacement the replacement format string + * \param src Source String. + * \param macro_name The name of the macro. + * \param replacement The replacement format string. * * In \p src, replace each occurence of \p macro_name(arg) by the string * determined by the \p replacement format string. \p replacement may (but @@ -79,7 +79,7 @@ static const struct para_macro mysql_macro_list[] = { * replaced by \p arg. * * \return A string in which all matches in \p src are replaced, or \p NULL if - * an syntax error was encountered. Caller must free the result. + * an error was encountered. Caller must free the result. * * \sa regcomp(3) */ @@ -95,7 +95,8 @@ __must_check __malloc static char *s_a_r(const char *src, const char* macro_name if (!macro_name || !replacement || !src) return para_strdup(src); - regcomp(&preg, macro_name, 0); + if (regcomp(&preg, macro_name, 0) != 0) + return NULL; while (regexec(&preg, bufptr, nmatch, pmatch, eflags) != REG_NOMATCH) { char *tmp, *arg, *o_bracket, *c_bracket;