Alan Coopersmith <[email protected]> writes: > I can take a pass over to see about converting all to that style. Would > you even want to see it used where the blocks were more natural, such > as
I'm thinking the most important thing right now is to make it easy to
write and review -- essentially, the changes I'd like to see is where
the object declaration doesn't move, and the very first setting of
anything in the object uses the structure assignment to initialize all
of the fields:
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1660,9 +1660,11 @@ ProcSetModifierMapping(ClientPtr client)
bytes_to_int32(sizeof(xSetModifierMappingReq))))
return BadLength;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xSetModifierMappingReply) {
+ .type = X_Reply,
+ .length = 0,
+ .sequenceNumber = client->sequence
+ };
rc = change_modmap(client, PickKeyboard(client), (KeyCode *) &stuff[1],
stuff->numKeyPerModifier);
That gains some of the benefits of not writing stuff twice, while making
the code transformation obvious. Moving the assignments around in the
code means needing to look at the intervening lines to ensure that the
values of the expressions would be the same in both places.
As a bogus example, if 'client->sequence' was modified between the start
and end of this function, a patch would never show it...
--
[email protected]
pgppXsG1PMp4R.pgp
Description: PGP signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
