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 06:19:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-12-10 06:55:28 +0300
commited2556e22cc2d3629833bdc39ec1852ee5c4470e (patch)
tree907e410290982aa9314c1d10494295ad33ad8074 /source/blender/makesrna/intern/rna_access.c
parentc5aaa11c3bfc98a168128971f1e85a014efba07f (diff)
Cleanup: declare variables when used (RNA)
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 80e9d15bb28..67f88d31afd 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -4957,11 +4957,7 @@ PointerRNA rna_array_lookup_int(
static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int bracket)
{
const char *p;
- char *buf;
- char quote = '\0';
- int len, escape;
-
- len = 0;
+ int len = 0;
if (bracket) {
/* get data between [], check escaping ] with \] */
@@ -4975,9 +4971,9 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
p = *path;
/* 2 kinds of lookups now, quoted or unquoted */
- quote = *p;
+ char quote = *p;
- if (quote != '"') { /* " - this comment is hack for Aligorith's text editor's sanity */
+ if (quote != '"') {
quote = 0;
}
@@ -4988,14 +4984,14 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
}
}
else {
- escape = 0;
+ bool escape = false;
/* skip the first quote */
len++;
p++;
while (*p && (*p != quote || escape)) {
/* A pair of back-slashes represents a single back-slash,
* only use a single back-slash for escaping. */
- escape = (escape == 0) && (*p == '\\');
+ escape = (escape == false) && (*p == '\\');
len++;
p++;
}
@@ -5024,13 +5020,8 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
return NULL;
}
- /* try to use fixed buffer if possible */
- if (len + 1 < fixedlen) {
- buf = fixedbuf;
- }
- else {
- buf = MEM_mallocN(sizeof(char) * (len + 1), "rna_path_token");
- }
+ /* Try to use fixed buffer if possible. */
+ char *buf = (len + 1 < fixedlen) ? fixedbuf : MEM_mallocN(sizeof(char) * (len + 1), __func__);
/* copy string, taking into account escaped ] */
if (bracket) {