diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-12-10 06:02:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-12-10 06:40:01 +0300 |
commit | 2f86518ac085dde77977912b3cfcadd2bbd41080 (patch) | |
tree | 411517737ee7287cf71317b9bac45a5aef3c3ecd /source | |
parent | 82e1b65d91f9ac8f09a9a4698776f21113db46c9 (diff) |
RNA: use BLI_str_unescape utility for parsing escaped strings
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 94d839a7c30..80e9d15bb28 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4959,7 +4959,7 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int const char *p; char *buf; char quote = '\0'; - int i, j, len, escape; + int len, escape; len = 0; @@ -5034,21 +5034,8 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int /* copy string, taking into account escaped ] */ if (bracket) { - for (p = *path, i = 0, j = 0; i < len; i++, p++) { - if (*p == '\\') { - if (*(p + 1) == '\\') { - /* Un-escape pairs of back-slashes into a single back-slash. */ - p++; - i += 1; - } - else if (*(p + 1) == quote) { - continue; - } - } - buf[j++] = *p; - } - - buf[j] = 0; + BLI_str_unescape(buf, *path, len); + p = (*path) + len; } else { memcpy(buf, *path, sizeof(char) * len); |