From 68e6debd8d2cf0762fb9084f08ffdf632050f586 Mon Sep 17 00:00:00 2001 From: Honkazel <169346573+Honkazel@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:53:15 +0500 Subject: [PATCH] core: member initialize and rm redundant cast Both pResource can be member initialized and cast is redundant since 4a53f1a --- src/main.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0bce456..4f6be97 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -712,7 +712,7 @@ void {}::{}({}) {{ if (!pResource) return{};{} - auto proxy = wl_proxy_marshal_flags((wl_proxy*)pResource, {}, {}, wl_proxy_get_version((wl_proxy*)pResource), {}{});{} + auto proxy = wl_proxy_marshal_flags(pResource, {}, {}, wl_proxy_get_version(pResource), {}{});{} }} )#", ptrRetType, IFACE_CLASS_NAME_CAMEL, EVENT_NAME, argsC, (ev.newIdType.empty() ? "" : " nullptr"), @@ -854,8 +854,8 @@ const wl_interface {} = {{ // protocol body if (!clientCode) { SOURCE += std::format(R"#( -{}::{}(wl_client* client, uint32_t version, uint32_t id) {{ - pResource = wl_resource_create(client, &{}, version, id); +{}::{}(wl_client* client, uint32_t version, uint32_t id) : + pResource(wl_resource_create(client, &{}, version, id)) {{ if (!pResource) return; @@ -912,8 +912,7 @@ void {}::onDestroyCalled() {{ DTOR_FUNC = "wl_proxy_destroy(pResource)"; SOURCE += std::format(R"#( -{}::{}(wl_proxy* resource) {{ - pResource = resource; +{}::{}(wl_proxy* resource) : pResource(resource) {{ if (!pResource) return; @@ -1059,4 +1058,4 @@ int main(int argc, char** argv, char** envp) { } return 0; -} \ No newline at end of file +}