[Bf-blender-cvs] [84da76a96c5] master: Cleanup: use POINTER_OFFSET macro

Campbell Barton noreply at git.blender.org
Sun Mar 7 09:28:02 CET 2021


Commit: 84da76a96c5c2b59aeb67fa905398f656af25649
Author: Campbell Barton
Date:   Sun Mar 7 19:27:11 2021 +1100
Branches: master
https://developer.blender.org/rB84da76a96c5c2b59aeb67fa905398f656af25649

Cleanup: use POINTER_OFFSET macro

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

M	source/blender/blenlib/intern/string_utils.c

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

diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c
index dbeb75570fb..dbe5c96260b 100644
--- a/source/blender/blenlib/intern/string_utils.c
+++ b/source/blender/blenlib/intern/string_utils.c
@@ -333,11 +333,6 @@ bool BLI_uniquename_cb(UniquenameCheckCallback unique_check,
   return false;
 }
 
-/* little helper macro for BLI_uniquename */
-#ifndef GIVE_STRADDR
-#  define GIVE_STRADDR(data, offset) (((char *)data) + offset)
-#endif
-
 /**
  * Generic function to set a unique name. It is only designed to be used in situations
  * where the name is part of the struct.
@@ -353,7 +348,7 @@ static bool uniquename_find_dupe(ListBase *list, void *vlink, const char *name,
 
   for (link = list->first; link; link = link->next) {
     if (link != vlink) {
-      if (STREQ(GIVE_STRADDR(link, name_offs), name)) {
+      if (STREQ(POINTER_OFFSET((const char *)link, name_offs), name)) {
         return true;
       }
     }
@@ -403,7 +398,7 @@ bool BLI_uniquename(
   }
 
   return BLI_uniquename_cb(
-      uniquename_unique_check, &data, defname, delim, GIVE_STRADDR(vlink, name_offs), name_len);
+      uniquename_unique_check, &data, defname, delim, POINTER_OFFSET(vlink, name_offs), name_len);
 }
 
 /* ------------------------------------------------------------------------- */



More information about the Bf-blender-cvs mailing list