From: Michael Tremer Date: Sat, 1 Jun 2019 13:35:16 +0000 (+0100) Subject: libpakfire: parser: Skip expansion when possible X-Git-Tag: 0.9.28~1285^2~987 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7a4c0f55ced88cae6fdf5777eac063791966ae5;p=pakfire.git libpakfire: parser: Skip expansion when possible This will spare us going through a lot of code when there is no variable in a string Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/parser.c b/src/libpakfire/parser.c index c0bc5182e..617d49e64 100644 --- a/src/libpakfire/parser.c +++ b/src/libpakfire/parser.c @@ -312,6 +312,10 @@ PAKFIRE_EXPORT char* pakfire_parser_expand(PakfireParser parser, const char* val if (!value) return NULL; + char* pos = strchr(value, '%'); + if (!pos) + return pakfire_strdup(value); + // Compile the regular expression regex_t preg; int r = regcomp(&preg, VARIABLE_PATTERN, REG_EXTENDED);