Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-12-10 07:06:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-12-10 07:06:16 +0300
commit2814cdbd86389516eeea570ae12f7c2c7338d81b (patch)
tree6e8ec57790ba650c92a2212ebd3189d800e2230e /source/blender/makesrna/intern/rna_access.c
parentaef9243ebb4f3d97d4d9f0eb731250a8c6c1db28 (diff)
BLI_string: extract quote utility into BLI_str_escape_find_quote
Duplicate logic for this exists in BLI_str_quoted_substrN, which doesn't properly support escaping.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 70b4d4204df..deedf72600a 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -4978,21 +4978,16 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
}
}
else {
- bool escape = false;
- /* Skip the first quote. */
- len++;
- p++;
- while (*p && (*p != '"' || escape)) {
- /* A pair of back-slashes represents a single back-slash,
- * only use a single back-slash for escaping. */
- escape = (escape == false) && (*p == '\\');
- len++;
- p++;
+ const char *p_end = BLI_str_escape_find_quote(p + 1);
+ if (p_end == NULL) {
+ /* No Matching quote. */
+ return NULL;
}
-
/* Skip the last quoted char to get the `]`. */
- len++;
- p++;
+ p_end += 1;
+
+ len += (p_end - p);
+ p = p_end;
}
if (*p != ']') {