Skip to content

Comments

libubus: Add UBUS_OBJECT() macro for initializing an ubus_object#8

Open
ksperling-apple wants to merge 1 commit intoopenwrt:masterfrom
ksperling-apple:ubus-object-macro
Open

libubus: Add UBUS_OBJECT() macro for initializing an ubus_object#8
ksperling-apple wants to merge 1 commit intoopenwrt:masterfrom
ksperling-apple:ubus-object-macro

Conversation

@ksperling-apple
Copy link
Contributor

Especially in C++ (where depending on compiler settings, field order and completeness is enforced), initializing an ubus_object is a little tedious. Introduce an UBUS_OBJECT() macro that can be used to initialize an ubus_object with a name and type.

The n_methods field is set to -1 to signal to ubus_add_object() that methods should be copied from the object type (if they haven't been changed in the meantime). Copying them from the type in UBUS_OBJECT() directly is not desirable because it would make for a non-constant initializer.

Especially in C++ (where depending on compiler settings, field order and
completeness is enforced), initializing an ubus_object is a little tedious.
Introduce an UBUS_OBJECT() macro that can be used to initialize an
ubus_object with a name and type.

The n_methods field is set to -1 to signal to ubus_add_object() that
methods should be copied from the object type (if they haven't been changed
in the meantime). Copying them from the type in UBUS_OBJECT() directly is
not desirable because it would make for a non-constant initializer.

Signed-off-by: Karsten Sperling <ksperling@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant