[PATCH 5/5] idl: use logical dcerpc_object ordering

David Disseldorp ddiss at samba.org
Sun Jan 5 22:20:08 MST 2014


This IDL code:
typedef [nodiscriminant] union {
	[default] dcerpc_empty empty;
	[case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
} dcerpc_object;

Compiles into the following default-before-case marshalling code:
switch (level) {
	default: {
		NDR_CHECK(ndr_push_dcerpc_empty(ndr, NDR_SCALARS, &r->empty));
	break; }

	case LIBNDR_FLAG_OBJECT_PRESENT: {
		NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->object));
	break; }

}

The default entry before case does not change the flow of execution but
is more logical when present at the end of the switch statement.

Signed-off-by: David Disseldorp <ddiss at samba.org>
---
 librpc/idl/dcerpc.idl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
index 86f22a4..8fadf1c 100644
--- a/librpc/idl/dcerpc.idl
+++ b/librpc/idl/dcerpc.idl
@@ -34,8 +34,8 @@ interface dcerpc
 	} dcerpc_empty;
 
 	typedef [nodiscriminant] union {
-		[default] dcerpc_empty empty;
 		[case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
+		[default] dcerpc_empty empty;
 	} dcerpc_object;
 
 	typedef struct {
-- 
1.8.1.4



More information about the samba-technical mailing list