From 8b8af19f15259b62ac3d2eae68ef5ea9966be64f Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Sat, 14 May 2022 23:12:38 +0200 Subject: [PATCH 13/13] generate_packets.py: clean up string formatting for Variant.get_receive() helpers See osdn#44601 Signed-off-by: Alina Lenk --- common/generate_packets.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/generate_packets.py b/common/generate_packets.py index 251b64d166..c10f565892 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -992,7 +992,7 @@ while (TRUE) {{ }} if (i > {array_size_u}) {{ RECEIVE_PACKET_FIELD_ERROR({self.name}, - \": unexpected value %%d \" + \": unexpected value %d \" \"(> {array_size_u}) in array diff\", i); }} else {{ @@ -1406,9 +1406,9 @@ static char *stats_{self.name}_names[] = {{{names}}}; ''' body1="" for field in self.key_fields: - body1 += prefix(" ", field.get_get(1) % self.__dict__) + "\n" + body1 += prefix(" ", field.get_get(1)) + "\n" body1=body1+"\n#else /* FREECIV_DELTA_PROTOCOL */\n" - body2 = self.get_delta_receive_body() % self.__dict__ + body2 = self.get_delta_receive_body() else: delta_header="" delta_body1="" @@ -1416,7 +1416,7 @@ static char *stats_{self.name}_names[] = {{{names}}}; body2="" nondelta="" for field in self.fields: - nondelta += prefix(" ", field.get_get(0) % self.__dict__) + "\n" + nondelta += prefix(" ", field.get_get(0)) + "\n" if not nondelta: nondelta=" real_packet->__dummy = 0xff;" body1=body1+nondelta+"\n#endif\n" @@ -1479,7 +1479,9 @@ static char *stats_{self.name}_names[] = {{{names}}}; if key1: key1=key1+"\n\n" if key2: key2="\n\n"+key2 if self.gen_log: - fl=' %(log_macro)s(" no old info");\n' + fl = """\ + {self.log_macro}(" no old info"); +""".format(self = self) else: fl="" body = """ -- 2.17.1