core: object: implement rvalue object support
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
#define B_OBJECT(p) ((b_object *)(p))
|
#define B_OBJECT(p) ((b_object *)(p))
|
||||||
#define B_TYPE_OBJECT (b_object_get_type())
|
#define B_TYPE_OBJECT (b_object_get_type())
|
||||||
|
|
||||||
|
#define B_RV(p) (b_object_make_rvalue(p))
|
||||||
|
|
||||||
struct b_stream;
|
struct b_stream;
|
||||||
|
|
||||||
typedef struct _b_object b_object;
|
typedef struct _b_object b_object;
|
||||||
@@ -26,6 +28,7 @@ BLUE_API void *b_object_get_interface(const b_object *object, b_type type);
|
|||||||
|
|
||||||
BLUE_API b_object *b_object_ref(b_object *p);
|
BLUE_API b_object *b_object_ref(b_object *p);
|
||||||
BLUE_API void b_object_unref(b_object *p);
|
BLUE_API void b_object_unref(b_object *p);
|
||||||
|
BLUE_API b_object *b_object_make_rvalue(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(const b_object *p, struct b_stream *out);
|
BLUE_API void b_object_to_string(const b_object *p, struct b_stream *out);
|
||||||
|
|||||||
@@ -157,3 +157,9 @@ void b_object_unref(struct _b_object *p)
|
|||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct _b_object *b_object_make_rvalue(struct _b_object *p)
|
||||||
|
{
|
||||||
|
p->obj_ref = 0;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user