[Bf-blender-cvs] [dea9aa1591c] temp-dna-rename: Rename 'elem_dna' to 'elem_full'

Campbell Barton noreply at git.blender.org
Wed Feb 13 00:37:05 CET 2019


Commit: dea9aa1591c7fc1a66d361b2e7f047ff687650e3
Author: Campbell Barton
Date:   Wed Feb 13 10:34:44 2019 +1100
Branches: temp-dna-rename
https://developer.blender.org/rBdea9aa1591c7fc1a66d361b2e7f047ff687650e3

Rename 'elem_dna' to 'elem_full'

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

M	source/blender/makesdna/intern/dna_utils.c

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

diff --git a/source/blender/makesdna/intern/dna_utils.c b/source/blender/makesdna/intern/dna_utils.c
index 19bf312e6cd..0a8a7a63f2e 100644
--- a/source/blender/makesdna/intern/dna_utils.c
+++ b/source/blender/makesdna/intern/dna_utils.c
@@ -89,22 +89,22 @@ static bool is_identifier(const char c)
 	        (c == '_'));
 }
 
-uint DNA_elem_id_offset_start(const char *elem_dna)
+uint DNA_elem_id_offset_start(const char *elem_full)
 {
-	uint elem_dna_offset = 0;
-	while (!is_identifier(elem_dna[elem_dna_offset])) {
-		elem_dna_offset++;
+	uint elem_full_offset = 0;
+	while (!is_identifier(elem_full[elem_full_offset])) {
+		elem_full_offset++;
 	}
-	return elem_dna_offset;
+	return elem_full_offset;
 }
 
-uint DNA_elem_id_offset_end(const char *elem_dna)
+uint DNA_elem_id_offset_end(const char *elem_full)
 {
-	uint elem_dna_offset = 0;
-	while (is_identifier(elem_dna[elem_dna_offset])) {
-		elem_dna_offset++;
+	uint elem_full_offset = 0;
+	while (is_identifier(elem_full[elem_full_offset])) {
+		elem_full_offset++;
 	}
-	return elem_dna_offset;
+	return elem_full_offset;
 }
 
 /**
@@ -125,16 +125,16 @@ void DNA_elem_id_strip(char *elem_dst, const char *elem_src)
  */
 bool DNA_elem_id_match(
         const char *elem_search, const int elem_search_len,
-        const char *elem_dna,
-        uint *r_elem_dna_offset)
+        const char *elem_full,
+        uint *r_elem_full_offset)
 {
 	BLI_assert(strlen(elem_search) == elem_search_len);
-	const uint elem_dna_offset = DNA_elem_id_offset_start(elem_dna);
-	const char *elem_dna_trim = elem_dna + elem_dna_offset;
-	if (strncmp(elem_search, elem_dna_trim, elem_search_len) == 0) {
-		const char c = elem_dna_trim[elem_search_len];
+	const uint elem_full_offset = DNA_elem_id_offset_start(elem_full);
+	const char *elem_full_trim = elem_full + elem_full_offset;
+	if (strncmp(elem_search, elem_full_trim, elem_search_len) == 0) {
+		const char c = elem_full_trim[elem_search_len];
 		if (c == '\0' || !is_identifier(c)) {
-			*r_elem_dna_offset = elem_dna_offset;
+			*r_elem_full_offset = elem_full_offset;
 			return true;
 		}
 	}
@@ -148,32 +148,32 @@ char *DNA_elem_id_rename(
         struct MemArena *mem_arena,
         const char *elem_src, const int elem_src_len,
         const char *elem_dst, const int elem_dst_len,
-        const char *elem_dna_src, const int elem_dna_src_len,
-        const uint elem_dna_offset_start)
+        const char *elem_full_src, const int elem_full_src_len,
+        const uint elem_full_offset_start)
 {
 	BLI_assert(strlen(elem_src) == elem_src_len);
 	BLI_assert(strlen(elem_dst) == elem_dst_len);
-	BLI_assert(strlen(elem_dna_src) == elem_dna_src_len);
-	BLI_assert(DNA_elem_id_offset_start(elem_dna_src) == elem_dna_offset_start);
+	BLI_assert(strlen(elem_full_src) == elem_full_src_len);
+	BLI_assert(DNA_elem_id_offset_start(elem_full_src) == elem_full_offset_start);
 	UNUSED_VARS_NDEBUG(elem_src);
 
-	const int elem_final_len = (elem_dna_src_len - elem_src_len) + elem_dst_len;
-	char *elem_dna_dst = BLI_memarena_alloc(mem_arena, elem_final_len + 1);
+	const int elem_final_len = (elem_full_src_len - elem_src_len) + elem_dst_len;
+	char *elem_full_dst = BLI_memarena_alloc(mem_arena, elem_final_len + 1);
 	uint i = 0;
-	if (elem_dna_offset_start != 0) {
-		memcpy(elem_dna_dst, elem_dna_src, elem_dna_offset_start);
-		i = elem_dna_offset_start;
+	if (elem_full_offset_start != 0) {
+		memcpy(elem_full_dst, elem_full_src, elem_full_offset_start);
+		i = elem_full_offset_start;
 	}
-	memcpy(&elem_dna_dst[i], elem_dst, elem_dst_len + 1);
+	memcpy(&elem_full_dst[i], elem_dst, elem_dst_len + 1);
 	i += elem_dst_len;
-	uint elem_dna_offset_end = elem_dna_offset_start + elem_src_len;
-	if (elem_dna_src[elem_dna_offset_end] != '\0') {
-		const int elem_dna_tail_len = (elem_dna_src_len - elem_dna_offset_end);
-		memcpy(&elem_dna_dst[i], &elem_dna_src[elem_dna_offset_end], elem_dna_tail_len + 1);
-		i += elem_dna_tail_len;
+	uint elem_full_offset_end = elem_full_offset_start + elem_src_len;
+	if (elem_full_src[elem_full_offset_end] != '\0') {
+		const int elem_full_tail_len = (elem_full_src_len - elem_full_offset_end);
+		memcpy(&elem_full_dst[i], &elem_full_src[elem_full_offset_end], elem_full_tail_len + 1);
+		i += elem_full_tail_len;
 	}
-	BLI_assert((strlen(elem_dna_dst) == elem_final_len) && (i == elem_final_len));
-	return elem_dna_dst;
+	BLI_assert((strlen(elem_full_dst) == elem_final_len) && (i == elem_final_len));
+	return elem_full_dst;
 }
 
 /** \} */



More information about the Bf-blender-cvs mailing list