renamed to SAFE_CLEAR_OBJECT_ARRAY_OBJECT from SAFE_CLEAR_OBJECT_ARRAY, added a newly SAFE_CLEAR_OBJECT_ARRAY

This commit is contained in:
hyzboy 2024-07-01 23:22:44 +08:00
parent 538d19781a
commit 913bcfcfb2
2 changed files with 9 additions and 2 deletions

View File

@ -26,7 +26,7 @@ namespace hgl
} \ } \
} }
#define SAFE_CLEAR_OBJECT_ARRAY(name,num) { \ #define SAFE_CLEAR_OBJECT_ARRAY_OBJECT(name,num) { \
if(name&&num>=0) \ if(name&&num>=0) \
{ \ { \
int safe_clear_object_array_number=num; \ int safe_clear_object_array_number=num; \
@ -40,6 +40,13 @@ namespace hgl
} \ } \
} }
#define SAFE_CLEAR_OBJECT_ARRAY(name) { \
for(auto *obj:name)\
{ \
SAFE_CLEAR(obj); \
} \
}
#define FREE_OBJECT_ARRAY(name,num) { \ #define FREE_OBJECT_ARRAY(name,num) { \
if(name&&num>=0) \ if(name&&num>=0) \
{ \ { \

View File

@ -630,7 +630,7 @@ namespace hgl
~AutoDeleteObjectArray() ~AutoDeleteObjectArray()
{ {
SAFE_CLEAR_OBJECT_ARRAY(items,count); SAFE_CLEAR_OBJECT_ARRAY_OBJECT(items,count);
} }
TP *operator -> (){return items;} TP *operator -> (){return items;}