core: rename b_retain/b_release to b_object_ref/b_object_unref

This commit is contained in:
2025-10-18 21:51:51 +01:00
parent 6b5f0319c3
commit 4044961478
2 changed files with 5 additions and 4 deletions

View File

@@ -24,8 +24,8 @@ BLUE_API void *b_object_get_private(b_object *object, b_type type);
BLUE_API void *b_object_get_protected(b_object *object, b_type type); BLUE_API void *b_object_get_protected(b_object *object, b_type type);
BLUE_API void *b_object_get_interface(b_object *object, b_type type); BLUE_API void *b_object_get_interface(b_object *object, b_type type);
b_object *b_retain(b_object *p); BLUE_API b_object *b_object_ref(b_object *p);
BLUE_API void b_release(b_object *p); BLUE_API void b_object_unref(b_object *p);
BLUE_API b_object *b_object_create(b_type type); BLUE_API b_object *b_object_create(b_type type);
BLUE_API void b_object_to_string(b_object *p, struct b_stream *out); BLUE_API void b_object_to_string(b_object *p, struct b_stream *out);

View File

@@ -108,16 +108,17 @@ void *b_object_get_interface(struct _b_object *object, b_type type)
return z__b_class_get_interface(object->obj_type->r_class, type); return z__b_class_get_interface(object->obj_type->r_class, type);
} }
struct _b_object *b_retain(struct _b_object *p) struct _b_object *b_object_ref(struct _b_object *p)
{ {
p->obj_ref++; p->obj_ref++;
return p; return p;
} }
void b_release(struct _b_object *p) void b_object_unref(struct _b_object *p)
{ {
if (p->obj_ref > 1) { if (p->obj_ref > 1) {
p->obj_ref--; p->obj_ref--;
return;
} }
p->obj_ref = 0; p->obj_ref = 0;