No functional changes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
if (!value)
return NULL;
+ // Create a working copy of the string we are expanding
+ char* buffer = strdup(value);
+
+ // Fast path to check if there are any variables in here whatsoever
char* pos = strchr(value, '%');
if (!pos)
- return strdup(value);
+ return buffer;
// Compile the regular expression
regex_t preg;
return NULL;
}
- // Create a working copy of the string we are expanding
- char* buffer = strdup(value);
-
char* variable = NULL;
char* pattern = NULL;
const size_t max_groups = 2;