This is just a fast path to avoid doing unnecessary work.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
if (!buffer)
return -EINVAL;
- // There is nothing to expend on empty strings
- else if (!*buffer)
- return 0;
-
// Compile the regular expression
if (!regexes.variable) {
r = pakfire_compile_regex(parser->ctx, ®exes.variable, "%\\{([A-Za-z0-9_\\-]+)\\}");
if (!buffer)
goto ERROR;
+ // There is nothing to do for empty strings
+ if (!*buffer)
+ return buffer;
+
// Fast path to check if there are any variables in here whatsoever
char* pos = strchr(buffer, '%');
if (!pos)