pidl: Use a static const initialised struct in dcerpc_server_$name_init(void)
[samba.git] / pidl / lib / Parse / Pidl / Samba4 / NDR / Server.pm
index 0ffed39394f33c7cceb0e25450f3f1ef72304d19..70778640f045cfd298325b107e1a7961b3469f89 100644 (file)
@@ -257,17 +257,16 @@ static bool $name\__op_interface_by_name(struct dcesrv_interface *iface, const c
 NTSTATUS dcerpc_server_$name\_init(void)
 {
        NTSTATUS ret;
-       struct dcesrv_endpoint_server ep_server;
+       static const struct dcesrv_endpoint_server ep_server = {
+           /* fill in our name */
+           .name = \"$name\",
 
-       /* fill in our name */
-       ep_server.name = \"$name\";
-
-       /* fill in all the operations */
-       ep_server.init_server = $name\__op_init_server;
-
-       ep_server.interface_by_uuid = $name\__op_interface_by_uuid;
-       ep_server.interface_by_name = $name\__op_interface_by_name;
+           /* fill in all the operations */
+           .init_server = $name\__op_init_server,
 
+           .interface_by_uuid = $name\__op_interface_by_uuid,
+           .interface_by_name = $name\__op_interface_by_name
+       };
        /* register ourselves with the DCERPC subsystem. */
        ret = dcerpc_register_ep_server(&ep_server);