[Bf-blender-cvs] [3e44592cb9f] master: Cleanup: comment unused functions

Campbell Barton noreply at git.blender.org
Mon Sep 6 09:04:02 CEST 2021


Commit: 3e44592cb9f93b0f5b443c03c7d9103f28dba1a0
Author: Campbell Barton
Date:   Mon Sep 6 15:51:53 2021 +1000
Branches: master
https://developer.blender.org/rB3e44592cb9f93b0f5b443c03c7d9103f28dba1a0

Cleanup: comment unused functions

===================================================================

M	source/blender/blenlib/BLI_string.h
M	source/blender/blenlib/intern/string.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_access.c

===================================================================

diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index eab39433796..d3dc05edd9e 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -62,9 +62,11 @@ bool BLI_str_quoted_substr_range(const char *__restrict str,
                                  int *__restrict r_start,
                                  int *__restrict r_end) ATTR_WARN_UNUSED_RESULT
     ATTR_NONNULL(1, 2, 3, 4);
+#if 0 /* UNUSED */
 char *BLI_str_quoted_substrN(const char *__restrict str,
                              const char *__restrict prefix) ATTR_WARN_UNUSED_RESULT
     ATTR_NONNULL() ATTR_MALLOC;
+#endif
 bool BLI_str_quoted_substr(const char *__restrict str,
                            const char *__restrict prefix,
                            char *result,
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index fab5e44de25..0ea784c95b0 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -509,8 +509,12 @@ bool BLI_str_quoted_substr_range(const char *__restrict str,
   return true;
 }
 
+/* NOTE(@campbellbarton): in principal it should be possible to access a quoted string
+ * with an arbitrary size, currently all callers for this functionality
+ * happened to use a fixed size buffer, so only #BLI_str_quoted_substr is needed. */
+#if 0
 /**
- * Makes a copy of the text within the "" that appear after some text `blahblah`.
+ * Makes a copy of the text within the "" that appear after the contents of \a prefix.
  * i.e. for string `pose["apples"]` with prefix `pose[`, it will return `apples`.
  *
  * \param str: is the entire string to chop.
@@ -533,7 +537,21 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict
   }
   return result;
 }
+#endif
 
+/**
+ * Fills \a result with text within "" that appear after some the contents of \a prefix.
+ * i.e. for string `pose["apples"]` with prefix `pose[`, it will return `apples`.
+ *
+ * \param str: is the entire string to chop.
+ * \param prefix: is the part of the string to step over.
+ * \param result: The buffer to fill.
+ * \param result_maxlen: The maximum size of the buffer (including nil terminator).
+ * \return True if the prefix was found and the entire quoted string was copied into result.
+ *
+ * Assume that the strings returned must be freed afterwards,
+ * and that the inputs will contain data we want.
+ */
 bool BLI_str_quoted_substr(const char *__restrict str,
                            const char *__restrict prefix,
                            char *result,
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index c2ea901f4a1..f5ebdbb569e 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -1118,7 +1118,9 @@ bool RNA_property_assign_default(PointerRNA *ptr, PropertyRNA *prop);
 
 char *RNA_path_append(
     const char *path, PointerRNA *ptr, PropertyRNA *prop, int intkey, const char *strkey);
+#if 0 /* UNUSED. */
 char *RNA_path_back(const char *path);
+#endif
 
 /* path_resolve() variants only ensure that a valid pointer (and optionally property) exist */
 bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop);
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 0ba5b786187..effc56b15c5 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -5521,7 +5521,9 @@ char *RNA_path_append(
   return result;
 }
 
-char *RNA_path_back(const char *path)
+/* Having both path append & back seems like it could be useful,
+ * this function isn't used at the moment. */
+static char *UNUSED_FUNCTION(RNA_path_back)(const char *path)
 {
   char fixedbuf[256];
   const char *previous, *current;



More information about the Bf-blender-cvs mailing list