(1623) xkb: ProcXkbGetKbdByName(): static initialization of sub-reply structs
For easier reading, move th sub-reply structs down to where they're used first and use static initialization for the common fields. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									8dd361b642
								
							
						
					
					
						commit
						a1a114c0a9
					
				
							
								
								
									
										22
									
								
								xkb/xkb.c
								
								
								
								
							
							
						
						
									
										22
									
								
								xkb/xkb.c
								
								
								
								
							|  | @ -5820,11 +5820,6 @@ ProcXkbGetKbdByName(ClientPtr client) | ||||||
|     DeviceIntPtr dev; |     DeviceIntPtr dev; | ||||||
|     DeviceIntPtr tmpd; |     DeviceIntPtr tmpd; | ||||||
|     DeviceIntPtr master; |     DeviceIntPtr master; | ||||||
|     xkbGetMapReply mrep = { 0 }; |  | ||||||
|     xkbGetCompatMapReply crep = { 0 }; |  | ||||||
|     xkbGetIndicatorMapReply irep = { 0 }; |  | ||||||
|     xkbGetNamesReply nrep = { 0 }; |  | ||||||
|     xkbGetGeometryReply grep = { 0 }; |  | ||||||
|     XkbDescPtr xkb, new; |     XkbDescPtr xkb, new; | ||||||
|     XkbEventCauseRec cause; |     XkbEventCauseRec cause; | ||||||
|     unsigned char *str; |     unsigned char *str; | ||||||
|  | @ -5928,6 +5923,13 @@ ProcXkbGetKbdByName(ClientPtr client) | ||||||
|     Bool loaded = 0; |     Bool loaded = 0; | ||||||
| 
 | 
 | ||||||
|     stuff->want |= stuff->need; |     stuff->want |= stuff->need; | ||||||
|  | 
 | ||||||
|  |     xkbGetMapReply mrep          = { .type = X_Reply, .sequenceNumber = client->sequence }; | ||||||
|  |     xkbGetCompatMapReply crep    = { .type = X_Reply, .sequenceNumber = client->sequence }; | ||||||
|  |     xkbGetIndicatorMapReply irep = { .type = X_Reply, .sequenceNumber = client->sequence }; | ||||||
|  |     xkbGetNamesReply nrep        = { .type = X_Reply, .sequenceNumber = client->sequence }; | ||||||
|  |     xkbGetGeometryReply grep     = { .type = X_Reply, .sequenceNumber = client->sequence }; | ||||||
|  | 
 | ||||||
|     if (new) { |     if (new) { | ||||||
|         if (stuff->load) |         if (stuff->load) | ||||||
|             loaded = TRUE; |             loaded = TRUE; | ||||||
|  | @ -5941,9 +5943,7 @@ ProcXkbGetKbdByName(ClientPtr client) | ||||||
|         if (new->map == NULL) |         if (new->map == NULL) | ||||||
|             reported &= ~(XkbGBN_SymbolsMask | XkbGBN_TypesMask); |             reported &= ~(XkbGBN_SymbolsMask | XkbGBN_TypesMask); | ||||||
|         else if (reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask)) { |         else if (reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask)) { | ||||||
|             mrep.type = X_Reply; |  | ||||||
|             mrep.deviceID = dev->id; |             mrep.deviceID = dev->id; | ||||||
|             mrep.sequenceNumber = client->sequence; |  | ||||||
|             mrep.length = |             mrep.length = | ||||||
|                 ((SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2); |                 ((SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2); | ||||||
|             mrep.minKeyCode = new->min_key_code; |             mrep.minKeyCode = new->min_key_code; | ||||||
|  | @ -5976,9 +5976,7 @@ ProcXkbGetKbdByName(ClientPtr client) | ||||||
|         if (new->compat == NULL) |         if (new->compat == NULL) | ||||||
|             reported &= ~XkbGBN_CompatMapMask; |             reported &= ~XkbGBN_CompatMapMask; | ||||||
|         else if (reported & XkbGBN_CompatMapMask) { |         else if (reported & XkbGBN_CompatMapMask) { | ||||||
|             crep.type = X_Reply; |  | ||||||
|             crep.deviceID = dev->id; |             crep.deviceID = dev->id; | ||||||
|             crep.sequenceNumber = client->sequence; |  | ||||||
|             crep.groups = XkbAllGroupsMask; |             crep.groups = XkbAllGroupsMask; | ||||||
|             crep.nSI = crep.nTotalSI = new->compat->num_si; |             crep.nSI = crep.nTotalSI = new->compat->num_si; | ||||||
|             XkbComputeGetCompatMapReplySize(new->compat, &crep); |             XkbComputeGetCompatMapReplySize(new->compat, &crep); | ||||||
|  | @ -5987,9 +5985,7 @@ ProcXkbGetKbdByName(ClientPtr client) | ||||||
|         if (new->indicators == NULL) |         if (new->indicators == NULL) | ||||||
|             reported &= ~XkbGBN_IndicatorMapMask; |             reported &= ~XkbGBN_IndicatorMapMask; | ||||||
|         else if (reported & XkbGBN_IndicatorMapMask) { |         else if (reported & XkbGBN_IndicatorMapMask) { | ||||||
|             irep.type = X_Reply; |  | ||||||
|             irep.deviceID = dev->id; |             irep.deviceID = dev->id; | ||||||
|             irep.sequenceNumber = client->sequence; |  | ||||||
|             irep.which = XkbAllIndicatorsMask; |             irep.which = XkbAllIndicatorsMask; | ||||||
|             XkbComputeGetIndicatorMapReplySize(new->indicators, &irep); |             XkbComputeGetIndicatorMapReplySize(new->indicators, &irep); | ||||||
|             payload_length += SIZEOF(xGenericReply) / 4 + irep.length; |             payload_length += SIZEOF(xGenericReply) / 4 + irep.length; | ||||||
|  | @ -5997,9 +5993,7 @@ ProcXkbGetKbdByName(ClientPtr client) | ||||||
|         if (new->names == NULL) |         if (new->names == NULL) | ||||||
|             reported &= ~(XkbGBN_OtherNamesMask | XkbGBN_KeyNamesMask); |             reported &= ~(XkbGBN_OtherNamesMask | XkbGBN_KeyNamesMask); | ||||||
|         else if (reported & (XkbGBN_OtherNamesMask | XkbGBN_KeyNamesMask)) { |         else if (reported & (XkbGBN_OtherNamesMask | XkbGBN_KeyNamesMask)) { | ||||||
|             nrep.type = X_Reply; |  | ||||||
|             nrep.deviceID = dev->id; |             nrep.deviceID = dev->id; | ||||||
|             nrep.sequenceNumber = client->sequence; |  | ||||||
|             nrep.minKeyCode = new->min_key_code; |             nrep.minKeyCode = new->min_key_code; | ||||||
|             nrep.maxKeyCode = new->max_key_code; |             nrep.maxKeyCode = new->max_key_code; | ||||||
|             if (reported & XkbGBN_OtherNamesMask) { |             if (reported & XkbGBN_OtherNamesMask) { | ||||||
|  | @ -6028,9 +6022,7 @@ ProcXkbGetKbdByName(ClientPtr client) | ||||||
|         if (new->geom == NULL) |         if (new->geom == NULL) | ||||||
|             reported &= ~XkbGBN_GeometryMask; |             reported &= ~XkbGBN_GeometryMask; | ||||||
|         else if (reported & XkbGBN_GeometryMask) { |         else if (reported & XkbGBN_GeometryMask) { | ||||||
|             grep.type = X_Reply; |  | ||||||
|             grep.deviceID = dev->id; |             grep.deviceID = dev->id; | ||||||
|             grep.sequenceNumber = client->sequence; |  | ||||||
|             grep.found = TRUE; |             grep.found = TRUE; | ||||||
|             XkbComputeGetGeometryReplySize(new->geom, &grep, None); |             XkbComputeGetGeometryReplySize(new->geom, &grep, None); | ||||||
|             payload_length += SIZEOF(xGenericReply) / 4 + grep.length; |             payload_length += SIZEOF(xGenericReply) / 4 + grep.length; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue