diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2019-01-06 15:03:01 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2019-01-21 11:51:01 +0000 |
commit | 965248dcfbf53c792ec797fc0c10ffbdd902abc9 (patch) | |
tree | 70048cab601512a27f4ea7917d3729dce4829f7a /epan/wslua/wslua_proto.c | |
parent | 369c39ace8e364a0f589deaee67735c3f576e047 (diff) |
wslua: register attributes along with their class
At the moment, wslua first registers a class and then adds its
attributes in a second step. This registration creates empty __getters
and __setters tables which are later populated with the getter and
setter methods of the attributes.
Looking at the code and the comments, it seems that this was meant to be
a temporary solution. Eventually, attributes should be stored in
wslua_class' attrs field. The code to read and write attributes was
already updated to handle this.
Add new macros WSLUA_REGISTER_CLASS/_META_WITH_ATTRS that store the
attributes in wslua_class. Defining new macros is simpler than modifying
WSLUA_REGISTER_CLASS/_META to register attributes. If we did the latter,
we'd have to add an empty attribute list for all classes without
attributes.
We can now drop the WSLUA_REGISTER_ATTRIBUTES macro and the
wslua_reg_attributes function.
Using this new way of registering attributes, the __getters and
__setters tables are still available. The tests is the test suite that
rely on those tables still pass.
Change-Id: I526b9116435645c9c54ab69a05c3c7f3d459ec33
Reviewed-on: https://code.wireshark.org/review/31417
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/wslua/wslua_proto.c')
-rw-r--r-- | epan/wslua/wslua_proto.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index b153a7dfba..3583b6d459 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -549,8 +549,7 @@ WSLUA_META Proto_meta[] = { }; int Proto_register(lua_State* L) { - WSLUA_REGISTER_CLASS(Proto); - WSLUA_REGISTER_ATTRIBUTES(Proto); + WSLUA_REGISTER_CLASS_WITH_ATTRS(Proto); outstanding_FuncSavers = g_ptr_array_new(); |