(1623) xkb: XkbSendGeometry(): pass in struct as value instead of pointer
The function doesn't need to pass anything back via this pointer, it's the last consumer of this struct. Make understanding the code a bit easier and clear the road for further simplifications by passing the struct as value instead of pointer. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									1932110c5f
								
							
						
					
					
						commit
						42f4f2abb3
					
				
							
								
								
									
										54
									
								
								xkb/xkb.c
								
								
								
								
							
							
						
						
									
										54
									
								
								xkb/xkb.c
								
								
								
								
							|  | @ -4915,29 +4915,29 @@ XkbComputeGetGeometryReplySize(XkbGeometryPtr geom, | ||||||
| } | } | ||||||
| static int | static int | ||||||
| XkbSendGeometry(ClientPtr client, | XkbSendGeometry(ClientPtr client, | ||||||
|                 XkbGeometryPtr geom, xkbGetGeometryReply *rep) |                 XkbGeometryPtr geom, xkbGetGeometryReply rep) | ||||||
| { | { | ||||||
|     char *desc, *start; |     char *desc, *start = NULL; | ||||||
|     int len; |     int len = 0; | ||||||
| 
 | 
 | ||||||
|     if (geom != NULL) { |     if (geom != NULL) { | ||||||
|         start = desc = calloc(rep->length, 4); |         start = desc = calloc(rep.length, sizeof(CARD32)); | ||||||
|         if (!start) |         if (!start) | ||||||
|             return BadAlloc; |             return BadAlloc; | ||||||
|         len = rep->length * 4; |         len = rep.length * sizeof(CARD32); | ||||||
|         desc = XkbWriteCountedString(desc, geom->label_font, client->swapped); |         desc = XkbWriteCountedString(desc, geom->label_font, client->swapped); | ||||||
|         if (rep->nProperties > 0) |         if (rep.nProperties > 0) | ||||||
|             desc = XkbWriteGeomProperties(desc, geom, client->swapped); |             desc = XkbWriteGeomProperties(desc, geom, client->swapped); | ||||||
|         if (rep->nColors > 0) |         if (rep.nColors > 0) | ||||||
|             desc = XkbWriteGeomColors(desc, geom, client->swapped); |             desc = XkbWriteGeomColors(desc, geom, client->swapped); | ||||||
|         if (rep->nShapes > 0) |         if (rep.nShapes > 0) | ||||||
|             desc = XkbWriteGeomShapes(desc, geom, client->swapped); |             desc = XkbWriteGeomShapes(desc, geom, client->swapped); | ||||||
|         if (rep->nSections > 0) |         if (rep.nSections > 0) | ||||||
|             desc = XkbWriteGeomSections(desc, geom, client->swapped); |             desc = XkbWriteGeomSections(desc, geom, client->swapped); | ||||||
|         if (rep->nDoodads > 0) |         if (rep.nDoodads > 0) | ||||||
|             desc = XkbWriteGeomDoodads(desc, geom->num_doodads, geom->doodads, |             desc = XkbWriteGeomDoodads(desc, geom->num_doodads, geom->doodads, | ||||||
|                                        client->swapped); |                                        client->swapped); | ||||||
|         if (rep->nKeyAliases > 0) |         if (rep.nKeyAliases > 0) | ||||||
|             desc = XkbWriteGeomKeyAliases(desc, geom, client->swapped); |             desc = XkbWriteGeomKeyAliases(desc, geom, client->swapped); | ||||||
|         if ((desc - start) != (len)) { |         if ((desc - start) != (len)) { | ||||||
|             ErrorF |             ErrorF | ||||||
|  | @ -4945,24 +4945,20 @@ XkbSendGeometry(ClientPtr client, | ||||||
|                  len, (unsigned long) (desc - start)); |                  len, (unsigned long) (desc - start)); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     else { |  | ||||||
|         len = 0; |  | ||||||
|         start = NULL; |  | ||||||
|     } |  | ||||||
|     if (client->swapped) { |     if (client->swapped) { | ||||||
|         swaps(&rep->sequenceNumber); |         swaps(&rep.sequenceNumber); | ||||||
|         swapl(&rep->length); |         swapl(&rep.length); | ||||||
|         swapl(&rep->name); |         swapl(&rep.name); | ||||||
|         swaps(&rep->widthMM); |         swaps(&rep.widthMM); | ||||||
|         swaps(&rep->heightMM); |         swaps(&rep.heightMM); | ||||||
|         swaps(&rep->nProperties); |         swaps(&rep.nProperties); | ||||||
|         swaps(&rep->nColors); |         swaps(&rep.nColors); | ||||||
|         swaps(&rep->nShapes); |         swaps(&rep.nShapes); | ||||||
|         swaps(&rep->nSections); |         swaps(&rep.nSections); | ||||||
|         swaps(&rep->nDoodads); |         swaps(&rep.nDoodads); | ||||||
|         swaps(&rep->nKeyAliases); |         swaps(&rep.nKeyAliases); | ||||||
|     } |     } | ||||||
|     WriteToClient(client, SIZEOF(xkbGetGeometryReply), rep); |     WriteToClient(client, sizeof(xkbGetGeometryReply), &rep); | ||||||
|     if (len > 0) |     if (len > 0) | ||||||
|         WriteToClient(client, len, start); |         WriteToClient(client, len, start); | ||||||
|     if (start != NULL) |     if (start != NULL) | ||||||
|  | @ -4998,7 +4994,7 @@ ProcXkbGetGeometry(ClientPtr client) | ||||||
|     if (status != Success) |     if (status != Success) | ||||||
|         goto free_out; |         goto free_out; | ||||||
| 
 | 
 | ||||||
|     status = XkbSendGeometry(client, geom, &rep); |     status = XkbSendGeometry(client, geom, rep); | ||||||
| 
 | 
 | ||||||
| free_out: | free_out: | ||||||
|     if (shouldFree) |     if (shouldFree) | ||||||
|  | @ -6062,7 +6058,7 @@ ProcXkbGetKbdByName(ClientPtr client) | ||||||
|     if (reported & (XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask)) |     if (reported & (XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask)) | ||||||
|         XkbSendNames(client, new, nrep); |         XkbSendNames(client, new, nrep); | ||||||
|     if (reported & XkbGBN_GeometryMask) |     if (reported & XkbGBN_GeometryMask) | ||||||
|         XkbSendGeometry(client, new->geom, &grep); |         XkbSendGeometry(client, new->geom, grep); | ||||||
|     if (rep.loaded) { |     if (rep.loaded) { | ||||||
|         XkbDescPtr old_xkb; |         XkbDescPtr old_xkb; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue