clsptr -> cls.
This commit is contained in:
parent
794d352d33
commit
1b72ec95bf
4 changed files with 10 additions and 10 deletions
|
@ -72,7 +72,7 @@ equal(void *ptr1, void *ptr2)
|
||||||
CFWArray *array1, *array2;
|
CFWArray *array1, *array2;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (obj2->clsptr != cfw_array)
|
if (obj2->cls != cfw_array)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
array1 = ptr1;
|
array1 = ptr1;
|
||||||
|
|
|
@ -36,7 +36,7 @@ cfw_new(CFWClass *class, ...)
|
||||||
if ((obj = malloc(class->size)) == NULL)
|
if ((obj = malloc(class->size)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
obj->clsptr = class;
|
obj->cls = class;
|
||||||
obj->ref_cnt = 1;
|
obj->ref_cnt = 1;
|
||||||
|
|
||||||
if (class->ctor != NULL) {
|
if (class->ctor != NULL) {
|
||||||
|
@ -78,8 +78,8 @@ cfw_free(void *ptr)
|
||||||
{
|
{
|
||||||
CFWObject *obj = ptr;
|
CFWObject *obj = ptr;
|
||||||
|
|
||||||
if (obj->clsptr->dtor != NULL)
|
if (obj->cls->dtor != NULL)
|
||||||
obj->clsptr->dtor(obj);
|
obj->cls->dtor(obj);
|
||||||
|
|
||||||
free(obj);
|
free(obj);
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,8 @@ cfw_equal(void *ptr1, void *ptr2)
|
||||||
{
|
{
|
||||||
CFWObject *obj1 = ptr1, *obj2 = ptr2;
|
CFWObject *obj1 = ptr1, *obj2 = ptr2;
|
||||||
|
|
||||||
if (obj1->clsptr->equal != NULL) {
|
if (obj1->cls->equal != NULL) {
|
||||||
return obj1->clsptr->equal(obj1, obj2);
|
return obj1->cls->equal(obj1, obj2);
|
||||||
} else
|
} else
|
||||||
return (obj1 == obj2);
|
return (obj1 == obj2);
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,8 @@ cfw_copy(void *ptr)
|
||||||
{
|
{
|
||||||
CFWObject *obj = ptr;
|
CFWObject *obj = ptr;
|
||||||
|
|
||||||
if (obj->clsptr->copy != NULL)
|
if (obj->cls->copy != NULL)
|
||||||
return obj->clsptr->copy(obj);
|
return obj->cls->copy(obj);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "cfwclass.h"
|
#include "cfwclass.h"
|
||||||
|
|
||||||
typedef struct CFWObject {
|
typedef struct CFWObject {
|
||||||
CFWClass *clsptr;
|
CFWClass *cls;
|
||||||
int ref_cnt;
|
int ref_cnt;
|
||||||
} CFWObject;
|
} CFWObject;
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ equal(void *ptr1, void *ptr2)
|
||||||
CFWObject *obj2 = ptr2;
|
CFWObject *obj2 = ptr2;
|
||||||
CFWString *str1, *str2;
|
CFWString *str1, *str2;
|
||||||
|
|
||||||
if (obj2->clsptr != cfw_string)
|
if (obj2->cls != cfw_string)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
str1 = ptr1;
|
str1 = ptr1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue