From 277579088f241886d6d013704162b7eaebe11efd Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 4 Jul 2026 07:19:43 +0300
Subject: [PATCH 35/35] Rename 'dout' as 'd_out'

For clarity, and to silence codespell.

See RM #2071

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 common/generate_packets.py       |  40 +++----
 common/networking/dataio_json.c  | 190 +++++++++++++++---------------
 common/networking/dataio_json.h  |  52 ++++-----
 common/networking/dataio_raw.c   | 192 ++++++++++++++++---------------
 common/networking/dataio_raw.h   |  69 ++++++-----
 common/networking/packets.c      |  12 +-
 common/networking/packets.h      |  16 +--
 common/networking/packets_json.h |  48 ++++----
 8 files changed, 318 insertions(+), 301 deletions(-)

diff --git a/common/generate_packets.py b/common/generate_packets.py
index 1cfcd09b71..3527714b33 100755
--- a/common/generate_packets.py
+++ b/common/generate_packets.py
@@ -586,17 +586,17 @@ fc_assert({self.actual @ packet} <= MAX_UINT16);
         if self.constant:
             return f"""\
 #if {self.declared} <= MAX_UINT8
-e |= DIO_PUT(uint8, &dout, &field_addr, {index});
+e |= DIO_PUT(uint8, &d_out, &field_addr, {index});
 #else
-e |= DIO_PUT(uint16, &dout, &field_addr, {index});
+e |= DIO_PUT(uint16, &d_out, &field_addr, {index});
 #endif
 """
         else:
             return f"""\
 if ({self.actual @ packet} <= MAX_UINT8) {{
-  e |= DIO_PUT(uint8, &dout, &field_addr, {index});
+  e |= DIO_PUT(uint8, &d_out, &field_addr, {index});
 }} else {{
-  e |= DIO_PUT(uint16, &dout, &field_addr, {index});
+  e |= DIO_PUT(uint16, &d_out, &field_addr, {index});
 }}
 """
 
@@ -939,7 +939,7 @@ differ = ({location @ old} != {location @ new});
 
     def get_code_put(self, location: Location, packet: str, diff_packet: "str | None" = None) -> str:
         return f"""\
-e |= DIO_PUT({self.dataio_type}, &dout, &field_addr, {location @ packet});
+e |= DIO_PUT({self.dataio_type}, &d_out, &field_addr, {location @ packet});
 """
 
     def get_code_get(self, location: Location, packet: str, deep_diff: bool = False) -> str:
@@ -1074,7 +1074,7 @@ differ = ((int) ({location @ old} * {self.float_factor}) != (int) ({location @ n
 
     def get_code_put(self, location: Location, packet: str, diff_packet: "str | None" = None) -> str:
         return f"""\
-e |= DIO_PUT({self.dataio_type}, &dout, &field_addr, {location @ packet}, {self.float_factor:d});
+e |= DIO_PUT({self.dataio_type}, &d_out, &field_addr, {location @ packet}, {self.float_factor:d});
 """
 
     def get_code_get(self, location: Location, packet: str, deep_diff: bool = False) -> str:
@@ -1106,7 +1106,7 @@ differ = !BV_ARE_EQUAL({location @ old}, {location @ new});
 
     def get_code_put(self, location: Location, packet: str, diff_packet: "str | None" = None) -> str:
         return f"""\
-e |= DIO_BV_PUT(&dout, &field_addr, {location @ packet});
+e |= DIO_BV_PUT(&d_out, &field_addr, {location @ packet});
 """
 
     def get_code_get(self, location: Location, packet: str, deep_diff: bool = False) -> str:
@@ -1172,7 +1172,7 @@ differ = !are_{self.dataio_type}s_equal(&{location @ old}, &{location @ new});
 
     def get_code_put(self, location: Location, packet: str, diff_packet: "str | None" = None) -> str:
         return f"""\
-e |= DIO_PUT({self.dataio_type}, &dout, &field_addr, &{location @ packet});
+e |= DIO_PUT({self.dataio_type}, &d_out, &field_addr, &{location @ packet});
 """
 
 DEFAULT_REGISTRY.public_patterns[StructType.TYPE_PATTERN] = StructType
@@ -1321,7 +1321,7 @@ differ = (({self.size.actual @ old} != {self.size.actual @ new})
 
     def get_code_put(self, location: Location, packet: str, diff_packet: "str | None" = None) -> str:
         return f"""\
-e |= DIO_PUT({self.dataio_type}, &dout, &field_addr, &{location @ packet}, {self.size.actual @ packet});
+e |= DIO_PUT({self.dataio_type}, &d_out, &field_addr, &{location @ packet}, {self.size.actual @ packet});
 """
 
     def get_code_get(self, location: Location, packet: str, deep_diff: bool = False) -> str:
@@ -1416,7 +1416,7 @@ differ = FALSE;
             # which we're a long way from
             size_part = f"""\
   fc_assert({size.actual @ packet} < MAX_UINT16);
-  e |= DIO_PUT(arraylen, &dout, &field_addr, {size.actual @ packet});
+  e |= DIO_PUT(arraylen, &d_out, &field_addr, {size.actual @ packet});
 
 #ifdef FREECIV_JSON_CONNECTION
 """
@@ -1424,7 +1424,7 @@ differ = FALSE;
             size_part = f"""\
 #ifdef FREECIV_JSON_CONNECTION
   /* Create the array. */
-  e |= DIO_PUT(farray, &dout, &field_addr, {size.actual @ packet});
+  e |= DIO_PUT(farray, &d_out, &field_addr, {size.actual @ packet});
 
 """
 
@@ -1436,7 +1436,7 @@ differ = FALSE;
             head = f"""\
 if ({null_condition @ packet}) {{
   /* Transmit null as empty */
-  e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
+  e |= DIO_PUT(arraylen, &d_out, &field_addr, 0);
 }} else """
         else:
             # ends mid-line
@@ -1445,7 +1445,7 @@ if ({null_condition @ packet}) {{
   /* Transmit null as empty */
 #ifdef FREECIV_JSON_CONNECTION
   /* Create the array. */
-  e |= DIO_PUT(farray, &dout, &field_addr, 0);
+  e |= DIO_PUT(farray, &d_out, &field_addr, 0);
 #endif /* FREECIV_JSON_CONNECTION */
 }} else """
 
@@ -1489,14 +1489,14 @@ if ({null_condition @ packet}) {{
             size_head = f"""\
 
   /* Create the object to hold new size and delta. */
-  e |= DIO_PUT(object, &dout, &field_addr);
+  e |= DIO_PUT(object, &d_out, &field_addr);
 
   /* Enter object (start at size address). */
   {location.json_subloc} = plocation_field_new("size");
 #endif /* FREECIV_JSON_CONNECTION */
 
   /* Write the new size */
-  e |= DIO_PUT(uint16, &dout, &field_addr, {safe_size.actual @ packet});
+  e |= DIO_PUT(uint16, &d_out, &field_addr, {safe_size.actual @ packet});
 
 #ifdef FREECIV_JSON_CONNECTION
   /* Delta address. */
@@ -1541,7 +1541,7 @@ if ({null_condition @ packet}) {{
 {size_head}\
 
   /* Create the array. */
-  e |= DIO_PUT(farray, &dout, &field_addr, 0);
+  e |= DIO_PUT(farray, &d_out, &field_addr, 0);
 
   /* Enter array. */
   {location.json_subloc} = plocation_elem_new(0);
@@ -1559,7 +1559,7 @@ if ({null_condition @ packet}) {{
     {location.json_subloc}->number = -1;
 
     /* Create the diff array element. */
-    e |= DIO_PUT(object, &dout, &field_addr);
+    e |= DIO_PUT(object, &d_out, &field_addr);
 
     /* Enter diff array element (start at the index address). */
     {location.json_subloc}->number = count_{location.index}++;
@@ -1587,7 +1587,7 @@ if ({null_condition @ packet}) {{
   {location.json_subloc}->number = -1;
 
   /* Create the terminating diff array element. */
-  e |= DIO_PUT(object, &dout, &field_addr);
+  e |= DIO_PUT(object, &d_out, &field_addr);
 
   /* Enter diff array element (start at the index address). */
   {location.json_subloc}->number = count_{location.index};
@@ -2051,7 +2051,7 @@ differ = (strcmp(pstr_old ? pstr_old : "", pstr ? pstr : "") != 0);
 {{
   const char *pstr = strvec_get({location @ packet}, {location.index});
 
-  e |= DIO_PUT({self.dataio_type}, &dout, &field_addr, pstr ? pstr : "");
+  e |= DIO_PUT({self.dataio_type}, &d_out, &field_addr, pstr ? pstr : "");
 }}
 """
 
@@ -3024,7 +3024,7 @@ if (nullptr != *hash) {{
 field_addr.name = "fields";
 #endif /* FREECIV_JSON_CONNECTION */
 e = 0;
-e |= DIO_BV_PUT(&dout, &field_addr, fields);
+e |= DIO_BV_PUT(&d_out, &field_addr, fields);
 if (e) {{
   log_packet_detailed("fields bitvector error detected");
 }}
diff --git a/common/networking/dataio_json.c b/common/networking/dataio_json.c
index 40c45b42a1..0222619e08 100644
--- a/common/networking/dataio_json.c
+++ b/common/networking/dataio_json.c
@@ -212,16 +212,16 @@ static json_t *plocation_read_data(json_t *item,
 /**********************************************************************//**
   Insert 8 bit value with json.
 **************************************************************************/
-int dio_put_uint8_json(struct json_data_out *dout,
+int dio_put_uint8_json(struct json_data_out *d_out,
                        const struct plocation *location,
                        int value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_integer(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_integer(value));
   } else {
-    e = dio_put_uint8_raw(&dout->raw, value);
+    e = dio_put_uint8_raw(&d_out->raw, value);
   }
 
   return e;
@@ -230,16 +230,16 @@ int dio_put_uint8_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert 8 bit value with json.
 **************************************************************************/
-int dio_put_sint8_json(struct json_data_out *dout,
+int dio_put_sint8_json(struct json_data_out *d_out,
                        const struct plocation *location,
                        int value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_integer(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_integer(value));
   } else {
-    e = dio_put_sint8_raw(&dout->raw, value);
+    e = dio_put_sint8_raw(&d_out->raw, value);
   }
 
   return e;
@@ -248,15 +248,15 @@ int dio_put_sint8_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert value using 32 bits. May overflow.
 **************************************************************************/
-int dio_put_uint16_json(struct json_data_out *dout,
+int dio_put_uint16_json(struct json_data_out *d_out,
                         const struct plocation *location, int value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_integer(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_integer(value));
   } else {
-    e = dio_put_uint16_raw(&dout->raw, value);
+    e = dio_put_uint16_raw(&d_out->raw, value);
   }
 
   return e;
@@ -265,15 +265,15 @@ int dio_put_uint16_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert value using 32 bits. May overflow.
 **************************************************************************/
-int dio_put_sint16_json(struct json_data_out *dout,
+int dio_put_sint16_json(struct json_data_out *d_out,
                         const struct plocation *location, int value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_integer(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_integer(value));
   } else {
-    e = dio_put_sint16_raw(&dout->raw, value);
+    e = dio_put_sint16_raw(&d_out->raw, value);
   }
 
   return e;
@@ -282,13 +282,13 @@ int dio_put_sint16_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert the given cm_parameter struct
 **************************************************************************/
-int dio_put_cm_parameter_json(struct json_data_out *dout,
+int dio_put_cm_parameter_json(struct json_data_out *d_out,
                               struct plocation *location,
                               const struct cm_parameter *param)
 {
   int e = 0;
 
-  if (dout->json) {
+  if (d_out->json) {
     json_t *obj = json_object();
     json_t *min_surplus = json_array();
     json_t *factor = json_array();
@@ -312,9 +312,9 @@ int dio_put_cm_parameter_json(struct json_data_out *dout,
                              json_boolean(param->allow_specialists));
     e |= json_object_set_new(obj, "happy_factor",
                              json_integer(param->happy_factor));
-    e |= plocation_write_data(dout->json, location, obj);
+    e |= plocation_write_data(d_out->json, location, obj);
   } else {
-    e = dio_put_cm_parameter_raw(&dout->raw, param);
+    e = dio_put_cm_parameter_raw(&d_out->raw, param);
   }
 
   return e;
@@ -323,13 +323,13 @@ int dio_put_cm_parameter_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert the given unit_order struct
 **************************************************************************/
-int dio_put_unit_order_json(struct json_data_out *dout,
+int dio_put_unit_order_json(struct json_data_out *d_out,
                             struct plocation *location,
                             const struct unit_order *order)
 {
   int e = 0;
 
-  if (dout->json) {
+  if (d_out->json) {
     json_t *obj = json_object();
 
     e |= json_object_set_new(obj, "order", json_integer(order->order));
@@ -343,9 +343,9 @@ int dio_put_unit_order_json(struct json_data_out *dout,
     } else {
       e |= json_object_set_new(obj, "dir", json_integer(order->dir));
     }
-    e |= plocation_write_data(dout->json, location, obj);
+    e |= plocation_write_data(d_out->json, location, obj);
   } else {
-    e = dio_put_unit_order_raw(&dout->raw, order);
+    e = dio_put_unit_order_raw(&d_out->raw, order);
   }
 
   return e;
@@ -354,18 +354,18 @@ int dio_put_unit_order_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert worklist information.
 **************************************************************************/
-int dio_put_worklist_json(struct json_data_out *dout,
+int dio_put_worklist_json(struct json_data_out *d_out,
                           struct plocation *location,
                           const struct worklist *pwl)
 {
   int e = 0;
 
-  if (dout->json) {
+  if (d_out->json) {
     int i;
     const int size = worklist_length(pwl);
 
     /* Must create the array before insertion. */
-    e |= dio_put_farray_json(dout, location, size);
+    e |= dio_put_farray_json(d_out, location, size);
 
     location->sub_location = plocation_elem_new(0);
 
@@ -379,12 +379,12 @@ int dio_put_worklist_json(struct json_data_out *dout,
       e |= json_object_set_new(universal, "value",
                                json_integer(universal_number(pcp)));
 
-      e |= plocation_write_data(dout->json, location, universal);
+      e |= plocation_write_data(d_out->json, location, universal);
     }
 
     FC_FREE(location->sub_location);
   } else {
-    e = dio_put_worklist_raw(&dout->raw, pwl);
+    e = dio_put_worklist_raw(&d_out->raw, pwl);
   }
 
   return e;
@@ -739,7 +739,7 @@ bool dio_get_uint8_vec8_json(struct connection *pc, struct data_in *din,
                              int **values, int stop_value)
 {
   if (pc->json_mode) {
-    /* TODO: implement */
+    /* TODO: Implement */
     log_warn("Received unimplemeted data type uint8_vec8.");
   } else {
     return dio_get_uint8_vec8_raw(din, values, stop_value);
@@ -757,7 +757,7 @@ bool dio_get_uint16_vec8_json(struct connection *pc, struct data_in *din,
                               int stop_value)
 {
   if (pc->json_mode) {
-    /* TODO: implement */
+    /* TODO: Implement */
     log_warn("Received unimplemeted data type uint16_vec8.");
   } else {
     return dio_get_uint16_vec8_raw(din, values, stop_value);
@@ -889,12 +889,12 @@ bool dio_get_action_probability_json(struct connection *pc, struct data_in *din,
 /**********************************************************************//**
   Create an empty field array.
 **************************************************************************/
-int dio_put_farray_json(struct json_data_out *dout,
+int dio_put_farray_json(struct json_data_out *d_out,
                         const struct plocation *location, int size)
 {
   int e = 0;
 
-  if (dout->json) {
+  if (d_out->json) {
     int i;
     json_t *farray = json_array();
 
@@ -904,7 +904,7 @@ int dio_put_farray_json(struct json_data_out *dout,
       e |= json_array_append_new(farray, json_null());
     }
 
-    e |= plocation_write_data(dout->json, location, farray);
+    e |= plocation_write_data(d_out->json, location, farray);
   } else {
     /* No caller needs this */
   }
@@ -915,13 +915,13 @@ int dio_put_farray_json(struct json_data_out *dout,
 /**********************************************************************//**
   Create an empty JSON object.
 **************************************************************************/
-int dio_put_object_json(struct json_data_out *dout,
+int dio_put_object_json(struct json_data_out *d_out,
                         const struct plocation *location)
 {
   int e = 0;
 
-  if (dout->json) {
-    e |= plocation_write_data(dout->json, location, json_object());
+  if (d_out->json) {
+    e |= plocation_write_data(d_out->json, location, json_object());
   } else {
     /* No caller needs this */
   }
@@ -932,15 +932,15 @@ int dio_put_object_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert uint32 value.
 **************************************************************************/
-int dio_put_uint32_json(struct json_data_out *dout,
+int dio_put_uint32_json(struct json_data_out *d_out,
                         const struct plocation *location, int value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_integer(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_integer(value));
   } else {
-    e = dio_put_uint32_raw(&dout->raw, value);
+    e = dio_put_uint32_raw(&d_out->raw, value);
   }
 
   return e;
@@ -949,15 +949,15 @@ int dio_put_uint32_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert sint32 value.
 **************************************************************************/
-int dio_put_sint32_json(struct json_data_out *dout,
+int dio_put_sint32_json(struct json_data_out *d_out,
                         const struct plocation *location, int value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_integer(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_integer(value));
   } else {
-    e = dio_put_sint32_raw(&dout->raw, value);
+    e = dio_put_sint32_raw(&d_out->raw, value);
   }
 
   return e;
@@ -966,15 +966,16 @@ int dio_put_sint32_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert bool value.
 **************************************************************************/
-int dio_put_bool8_json(struct json_data_out *dout,
+int dio_put_bool8_json(struct json_data_out *d_out,
                        const struct plocation *location, bool value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, value ? json_true() : json_false());
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location,
+                             value ? json_true() : json_false());
   } else {
-    e = dio_put_bool8_raw(&dout->raw, value);
+    e = dio_put_bool8_raw(&d_out->raw, value);
   }
 
   return e;
@@ -983,15 +984,16 @@ int dio_put_bool8_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert bool value.
 **************************************************************************/
-int dio_put_bool32_json(struct json_data_out *dout,
+int dio_put_bool32_json(struct json_data_out *d_out,
                         const struct plocation *location, bool value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, value ? json_true() : json_false());
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location,
+                             value ? json_true() : json_false());
   } else {
-    e = dio_put_bool32_raw(&dout->raw, value);
+    e = dio_put_bool32_raw(&d_out->raw, value);
   }
 
   return e;
@@ -1000,16 +1002,16 @@ int dio_put_bool32_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert unsigned floating point value.
 **************************************************************************/
-int dio_put_ufloat_json(struct json_data_out *dout,
+int dio_put_ufloat_json(struct json_data_out *d_out,
                         const struct plocation *location,
                         float value, int float_factor)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_real(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_real(value));
   } else {
-    e = dio_put_ufloat_raw(&dout->raw, value, float_factor);
+    e = dio_put_ufloat_raw(&d_out->raw, value, float_factor);
   }
 
   return e;
@@ -1018,16 +1020,16 @@ int dio_put_ufloat_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert signed floating point value.
 **************************************************************************/
-int dio_put_sfloat_json(struct json_data_out *dout,
+int dio_put_sfloat_json(struct json_data_out *d_out,
                         const struct plocation *location,
                         float value, int float_factor)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_real(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_real(value));
   } else {
-    e = dio_put_sfloat_raw(&dout->raw, value, float_factor);
+    e = dio_put_sfloat_raw(&d_out->raw, value, float_factor);
   }
 
   return e;
@@ -1037,15 +1039,15 @@ int dio_put_sfloat_json(struct json_data_out *dout,
   Insert array length. In json mode, this will create an array at that
   location.
 **************************************************************************/
-int dio_put_arraylen_json(struct json_data_out *dout,
+int dio_put_arraylen_json(struct json_data_out *d_out,
                           const struct plocation *location, int size)
 {
   int e;
 
-  if (dout->json) {
-    e = dio_put_farray_json(dout, location, size);
+  if (d_out->json) {
+    e = dio_put_farray_json(d_out, location, size);
   } else {
-    e = dio_put_arraylen_raw(&dout->raw, size);
+    e = dio_put_arraylen_raw(&d_out->raw, size);
   }
 
   return e;
@@ -1054,18 +1056,18 @@ int dio_put_arraylen_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert vector of uint8 values, terminated by stop_value.
 **************************************************************************/
-int dio_put_uint8_vec8_json(struct json_data_out *dout,
+int dio_put_uint8_vec8_json(struct json_data_out *d_out,
                             const struct plocation *location,
                             int *values, int stop_value)
 {
   int e;
 
-  if (dout->json) {
-    /* TODO: implement. */
+  if (d_out->json) {
+    /* TODO: Implement. */
     log_error("Tried to send unimplemeted data type uint8_vec8.");
     e = -1;
   } else {
-    e = dio_put_uint8_vec8_raw(&dout->raw, values, stop_value);
+    e = dio_put_uint8_vec8_raw(&d_out->raw, values, stop_value);
   }
 
   return e;
@@ -1074,18 +1076,18 @@ int dio_put_uint8_vec8_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert vector of uint16 values, terminated by stop_value.
 **************************************************************************/
-int dio_put_uint16_vec8_json(struct json_data_out *dout,
+int dio_put_uint16_vec8_json(struct json_data_out *d_out,
                              const struct plocation *location, int *values,
                              int stop_value)
 {
   int e;
 
-  if (dout->json) {
-    /* TODO: implement. */
+  if (d_out->json) {
+    /* TODO: Implement. */
     log_error("Tried to send unimplemeted data type uint16_vec8.");
     e = -1;
   } else {
-    e = dio_put_uint16_vec8_raw(&dout->raw, values, stop_value);
+    e = dio_put_uint16_vec8_raw(&d_out->raw, values, stop_value);
   }
 
   return e;
@@ -1094,30 +1096,30 @@ int dio_put_uint16_vec8_json(struct json_data_out *dout,
 /**********************************************************************//**
   Send block of memory as byte array.
 **************************************************************************/
-int dio_put_memory_json(struct json_data_out *dout,
+int dio_put_memory_json(struct json_data_out *d_out,
                         struct plocation *location,
                         const void *value,
                         size_t size)
 {
   int e;
 
-  if (dout->json) {
+  if (d_out->json) {
     int i;
 
-    e = dio_put_farray_json(dout, location, size);
+    e = dio_put_farray_json(d_out, location, size);
 
     location->sub_location = plocation_elem_new(0);
 
     for (i = 0; i < size; i++) {
       location->sub_location->number = i;
 
-      e |= dio_put_uint8_json(dout, location,
+      e |= dio_put_uint8_json(d_out, location,
                               ((unsigned char *)value)[i]);
     }
 
     FC_FREE(location->sub_location);
   } else {
-    e = dio_put_memory_raw(&dout->raw, value, size);
+    e = dio_put_memory_raw(&d_out->raw, value, size);
   }
 
   return e;
@@ -1126,16 +1128,16 @@ int dio_put_memory_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert nullptr-terminated string.
 **************************************************************************/
-int dio_put_string_json(struct json_data_out *dout,
+int dio_put_string_json(struct json_data_out *d_out,
                         const struct plocation *location,
                         const char *value)
 {
   int e;
 
-  if (dout->json) {
-    e = plocation_write_data(dout->json, location, json_string(value));
+  if (d_out->json) {
+    e = plocation_write_data(d_out->json, location, json_string(value));
   } else {
-    e = dio_put_string_raw(&dout->raw, value);
+    e = dio_put_string_raw(&d_out->raw, value);
   }
 
   return e;
@@ -1144,25 +1146,25 @@ int dio_put_string_json(struct json_data_out *dout,
 /**********************************************************************//**
   Encode and write the specified string to the specified location.
 **************************************************************************/
-int dio_put_estring_json(struct json_data_out *dout,
+int dio_put_estring_json(struct json_data_out *d_out,
                          const struct plocation *location,
                          const char *value)
 {
   int e;
 
-  if (dout->json) {
+  if (d_out->json) {
     char *escaped_value;
 
     /* Let CURL find the length itself by passing 0 */
     escaped_value = curl_easy_escape(get_curl(), value, 0);
 
     /* Handle as a regular string from now on. */
-    e = dio_put_string_json(dout, location, escaped_value);
+    e = dio_put_string_json(d_out, location, escaped_value);
 
     /* CURL's memory management wants to free this itself. */
     curl_free(escaped_value);
   } else {
-    e = dio_put_estring_raw(&dout->raw, value);
+    e = dio_put_estring_raw(&d_out->raw, value);
   }
 
   return e;
@@ -1171,13 +1173,13 @@ int dio_put_estring_json(struct json_data_out *dout,
 /**********************************************************************//**
   Insert a single requirement.
 **************************************************************************/
-int dio_put_requirement_json(struct json_data_out *dout,
+int dio_put_requirement_json(struct json_data_out *d_out,
                              const struct plocation *location,
                              const struct requirement *preq)
 {
   int e = 0;
 
-  if (dout->json) {
+  if (d_out->json) {
     int kind, range, value;
     bool survives, present, quiet;
 
@@ -1199,9 +1201,9 @@ int dio_put_requirement_json(struct json_data_out *dout,
     e |= json_object_set_new(requirement, "quiet", json_boolean(quiet));
 
     /* Put the requirement object in the packet. */
-    e |= plocation_write_data(dout->json, location, requirement);
+    e |= plocation_write_data(d_out->json, location, requirement);
   } else {
-    e = dio_put_requirement_raw(&dout->raw, preq);
+    e = dio_put_requirement_raw(&d_out->raw, preq);
   }
 
   return e;
@@ -1210,13 +1212,13 @@ int dio_put_requirement_json(struct json_data_out *dout,
 /**********************************************************************//**
   Serialize an action probability.
 **************************************************************************/
-int dio_put_action_probability_json(struct json_data_out *dout,
+int dio_put_action_probability_json(struct json_data_out *d_out,
                                     const struct plocation *location,
                                     const struct act_prob *prob)
 {
   int e = 0;
 
-  if (dout->json) {
+  if (d_out->json) {
     /* Create the action probability object. */
     json_t *action_probability = json_object();
 
@@ -1226,9 +1228,9 @@ int dio_put_action_probability_json(struct json_data_out *dout,
     e |= json_object_set_new(action_probability, "max", json_integer(prob->max));
 
     /* Put the action probability object in the packet. */
-    e |= plocation_write_data(dout->json, location, action_probability);
+    e |= plocation_write_data(d_out->json, location, action_probability);
   } else {
-    e = dio_put_action_probability_raw(&dout->raw, prob);
+    e = dio_put_action_probability_raw(&d_out->raw, prob);
   }
 
   return e;
diff --git a/common/networking/dataio_json.h b/common/networking/dataio_json.h
index 2739a83e60..b8fead93b0 100644
--- a/common/networking/dataio_json.h
+++ b/common/networking/dataio_json.h
@@ -128,75 +128,75 @@ bool dio_get_uint16_vec8_json(struct connection *pc, struct data_in *din,
   dio_get_##f##_json(pc, d, l, ## __VA_ARGS__)
 
 /* puts */
-int dio_put_farray_json(struct json_data_out *dout,
+int dio_put_farray_json(struct json_data_out *d_out,
                         const struct plocation *location, int size);
-int dio_put_object_json(struct json_data_out *dout,
+int dio_put_object_json(struct json_data_out *d_out,
                         const struct plocation *location);
 
-int dio_put_type_json(struct json_data_out *dout, enum data_type type,
+int dio_put_type_json(struct json_data_out *d_out, enum data_type type,
                       const struct plocation *location,
                       int value);
 
-int dio_put_uint8_json(struct json_data_out *dout,
+int dio_put_uint8_json(struct json_data_out *d_out,
                        const struct plocation *location, int value);
-int dio_put_sint8_json(struct json_data_out *dout,
+int dio_put_sint8_json(struct json_data_out *d_out,
                        const struct plocation *location, int value);
-int dio_put_uint16_json(struct json_data_out *dout,
+int dio_put_uint16_json(struct json_data_out *d_out,
                         const struct plocation *location, int value);
-int dio_put_sint16_json(struct json_data_out *dout,
+int dio_put_sint16_json(struct json_data_out *d_out,
                         const struct plocation *location, int value);
-int dio_put_uint32_json(struct json_data_out *dout,
+int dio_put_uint32_json(struct json_data_out *d_out,
                         const struct plocation *location, int value);
-int dio_put_sint32_json(struct json_data_out *dout,
+int dio_put_sint32_json(struct json_data_out *d_out,
                         const struct plocation *location, int value);
-int dio_put_bool8_json(struct json_data_out *dout,
+int dio_put_bool8_json(struct json_data_out *d_out,
                        const struct plocation *location, bool value);
-int dio_put_bool32_json(struct json_data_out *dout,
+int dio_put_bool32_json(struct json_data_out *d_out,
                         const struct plocation *location, bool value);
-int dio_put_ufloat_json(struct json_data_out *dout,
+int dio_put_ufloat_json(struct json_data_out *d_out,
                         const struct plocation *location,
                         float value, int float_factor);
-int dio_put_sfloat_json(struct json_data_out *dout,
+int dio_put_sfloat_json(struct json_data_out *d_out,
                         const struct plocation *location,
                         float value, int float_factor);
 
-int dio_put_memory_json(struct json_data_out *dout,
+int dio_put_memory_json(struct json_data_out *d_out,
                         struct plocation *location,
                         const void *value, size_t size);
-int dio_put_string_json(struct json_data_out *dout,
+int dio_put_string_json(struct json_data_out *d_out,
                         const struct plocation *location,
                         const char *value);
-int dio_put_estring_json(struct json_data_out *dout,
+int dio_put_estring_json(struct json_data_out *d_out,
                          const struct plocation *location,
                          const char *value);
-int dio_put_cm_parameter_json(struct json_data_out *dout,
+int dio_put_cm_parameter_json(struct json_data_out *d_out,
                               struct plocation *location,
                               const struct cm_parameter *order);
-int dio_put_unit_order_json(struct json_data_out *dout,
+int dio_put_unit_order_json(struct json_data_out *d_out,
                             struct plocation *location,
                             const struct unit_order *order);
-int dio_put_worklist_json(struct json_data_out *dout,
+int dio_put_worklist_json(struct json_data_out *d_out,
                           struct plocation *location,
                           const struct worklist *pwl);
-int dio_put_requirement_json(struct json_data_out *dout,
+int dio_put_requirement_json(struct json_data_out *d_out,
                              const struct plocation *location,
                              const struct requirement *preq);
-int dio_put_action_probability_json(struct json_data_out *dout,
+int dio_put_action_probability_json(struct json_data_out *d_out,
                                     const struct plocation *location,
                                     const struct act_prob *prob);
 
-int dio_put_arraylen_json(struct json_data_out *dout,
+int dio_put_arraylen_json(struct json_data_out *d_out,
                           const struct plocation *location, int size);
-int dio_put_uint8_vec8_json(struct json_data_out *dout,
+int dio_put_uint8_vec8_json(struct json_data_out *d_out,
                             const struct plocation *location,
                             int *values, int stop_value);
-int dio_put_uint16_vec8_json(struct json_data_out *dout,
+int dio_put_uint16_vec8_json(struct json_data_out *d_out,
                              const struct plocation *location,
                              int *values, int stop_value);
 
 /* Should be a function but we need some macro magic. */
-#define DIO_BV_PUT(pdout, location, bv) \
-  dio_put_memory_json((pdout), location, (bv).vec, sizeof((bv).vec))
+#define DIO_BV_PUT(pd_out, location, bv) \
+  dio_put_memory_json((pd_out), location, (bv).vec, sizeof((bv).vec))
 
 #define DIO_PUT(f, d, l, ...) \
   dio_put_##f##_json(d, l, ## __VA_ARGS__)
diff --git a/common/networking/dataio_raw.c b/common/networking/dataio_raw.c
index 06d141c8a3..c093dca42c 100644
--- a/common/networking/dataio_raw.c
+++ b/common/networking/dataio_raw.c
@@ -145,13 +145,15 @@ bool dataio_get_conv_callback(char *dst, size_t ndst, const char *src,
 /**********************************************************************//**
   Returns TRUE iff the output has size bytes available.
 **************************************************************************/
-static bool enough_space(struct raw_data_out *dout, size_t size)
+static bool enough_space(struct raw_data_out *d_out, size_t size)
 {
-  if (dout->current + size > dout->dest_size) {
-    dout->too_short = TRUE;
+  if (d_out->current + size > d_out->dest_size) {
+    d_out->too_short = TRUE;
+
     return FALSE;
   } else {
-    dout->used = MAX(dout->used, dout->current + size);
+    d_out->used = MAX(d_out->used, d_out->current + size);
+
     return TRUE;
   }
 }
@@ -168,31 +170,31 @@ static bool enough_data(struct data_in *din, size_t size)
   Initializes the output to the given output buffer and the given
   buffer size.
 **************************************************************************/
-void dio_output_init(struct raw_data_out *dout, void *destination,
+void dio_output_init(struct raw_data_out *d_out, void *destination,
                      size_t dest_size)
 {
-  dout->dest = destination;
-  dout->dest_size = dest_size;
-  dout->current = 0;
-  dout->used = 0;
-  dout->too_short = FALSE;
+  d_out->dest = destination;
+  d_out->dest_size = dest_size;
+  d_out->current = 0;
+  d_out->used = 0;
+  d_out->too_short = FALSE;
 }
 
 /**********************************************************************//**
   Return the maximum number of bytes used.
 **************************************************************************/
-size_t dio_output_used(struct raw_data_out *dout)
+size_t dio_output_used(struct raw_data_out *d_out)
 {
-  return dout->used;
+  return d_out->used;
 }
 
 /**********************************************************************//**
   Rewinds the stream so that the put-functions start from the
   beginning.
 **************************************************************************/
-void dio_output_rewind(struct raw_data_out *dout)
+void dio_output_rewind(struct raw_data_out *d_out)
 {
-  dout->current = 0;
+  d_out->current = 0;
 }
 
 /**********************************************************************//**
@@ -262,7 +264,7 @@ bool dio_input_skip(struct data_in *din, size_t size)
 /**********************************************************************//**
   Insert value using 8 bits. May overflow.
 **************************************************************************/
-int dio_put_uint8_raw(struct raw_data_out *dout, int value)
+int dio_put_uint8_raw(struct raw_data_out *d_out, int value)
 {
   uint8_t x = value;
 
@@ -273,9 +275,9 @@ int dio_put_uint8_raw(struct raw_data_out *dout, int value)
                    "it will result %d at receiving side.",
                    value, (int) x);
 
-  if (enough_space(dout, 1)) {
-    memcpy(ADD_TO_POINTER(dout->dest, dout->current), &x, 1);
-    dout->current++;
+  if (enough_space(d_out, 1)) {
+    memcpy(ADD_TO_POINTER(d_out->dest, d_out->current), &x, 1);
+    d_out->current++;
   }
 
   return 0;
@@ -284,7 +286,7 @@ int dio_put_uint8_raw(struct raw_data_out *dout, int value)
 /**********************************************************************//**
   Insert value using 16 bits. May overflow.
 **************************************************************************/
-int dio_put_uint16_raw(struct raw_data_out *dout, int value)
+int dio_put_uint16_raw(struct raw_data_out *d_out, int value)
 {
   uint16_t x = htons(value);
 
@@ -295,9 +297,9 @@ int dio_put_uint16_raw(struct raw_data_out *dout, int value)
                    "it will result %d at receiving side.",
                    value, (int) ntohs(x));
 
-  if (enough_space(dout, 2)) {
-    memcpy(ADD_TO_POINTER(dout->dest, dout->current), &x, 2);
-    dout->current += 2;
+  if (enough_space(d_out, 2)) {
+    memcpy(ADD_TO_POINTER(d_out->dest, d_out->current), &x, 2);
+    d_out->current += 2;
   }
 
   return 0;
@@ -306,7 +308,7 @@ int dio_put_uint16_raw(struct raw_data_out *dout, int value)
 /**********************************************************************//**
   Insert value using 32 bits. May overflow.
 **************************************************************************/
-int dio_put_uint32_raw(struct raw_data_out *dout, int value)
+int dio_put_uint32_raw(struct raw_data_out *d_out, int value)
 {
   uint32_t x = htonl(value);
 
@@ -317,9 +319,9 @@ int dio_put_uint32_raw(struct raw_data_out *dout, int value)
                    "it will result %d at receiving side.",
                    value, (int) ntohl(x));
 
-  if (enough_space(dout, 4)) {
-    memcpy(ADD_TO_POINTER(dout->dest, dout->current), &x, 4);
-    dout->current += 4;
+  if (enough_space(d_out, 4)) {
+    memcpy(ADD_TO_POINTER(d_out->dest, d_out->current), &x, 4);
+    d_out->current += 4;
   }
 
   return 0;
@@ -328,21 +330,22 @@ int dio_put_uint32_raw(struct raw_data_out *dout, int value)
 /**********************************************************************//**
   Insert value using 'size' bits. May overflow.
 **************************************************************************/
-int dio_put_type_raw(struct raw_data_out *dout, enum data_type type, int value)
+int dio_put_type_raw(struct raw_data_out *d_out, enum data_type type,
+                     int value)
 {
   switch (type) {
   case DIOT_UINT8:
-    return dio_put_uint8_raw(dout, value);
+    return dio_put_uint8_raw(d_out, value);
   case DIOT_UINT16:
-    return dio_put_uint16_raw(dout, value);
+    return dio_put_uint16_raw(d_out, value);
   case DIOT_UINT32:
-    return dio_put_uint32_raw(dout, value);
+    return dio_put_uint32_raw(d_out, value);
   case DIOT_SINT8:
-    return dio_put_sint8_raw(dout, value);
+    return dio_put_sint8_raw(d_out, value);
   case DIOT_SINT16:
-    return dio_put_sint16_raw(dout, value);
+    return dio_put_sint16_raw(d_out, value);
   case DIOT_SINT32:
-    return dio_put_sint32_raw(dout, value);
+    return dio_put_sint32_raw(d_out, value);
   case DIOT_LAST:
     break;
   }
@@ -355,61 +358,62 @@ int dio_put_type_raw(struct raw_data_out *dout, enum data_type type, int value)
 /**********************************************************************//**
   Insert value using 8 bits. May overflow.
 **************************************************************************/
-int dio_put_sint8_raw(struct raw_data_out *dout, int value)
+int dio_put_sint8_raw(struct raw_data_out *d_out, int value)
 {
-  return dio_put_uint8_raw(dout, 0 <= value ? value : value + 0x100);
+  return dio_put_uint8_raw(d_out, 0 <= value ? value : value + 0x100);
 }
 
 /**********************************************************************//**
   Insert value using 16 bits. May overflow.
 **************************************************************************/
-int dio_put_sint16_raw(struct raw_data_out *dout, int value)
+int dio_put_sint16_raw(struct raw_data_out *d_out, int value)
 {
-  return dio_put_uint16_raw(dout, 0 <= value ? value : value + 0x10000);
+  return dio_put_uint16_raw(d_out, 0 <= value ? value : value + 0x10000);
 }
 
 /**********************************************************************//**
   Insert value using 32 bits. May overflow.
 **************************************************************************/
-int dio_put_sint32_raw(struct raw_data_out *dout, int value)
+int dio_put_sint32_raw(struct raw_data_out *d_out, int value)
 {
 #if SIZEOF_INT == 4
-  return dio_put_uint32_raw(dout, value);
+  return dio_put_uint32_raw(d_out, value);
 #else
-  return dio_put_uint32_raw(dout, (0 <= value ? value : value + 0x100000000));
+  return dio_put_uint32_raw(d_out, (0 <= value ? value : value + 0x100000000));
 #endif
 }
 
 /**********************************************************************//**
   Insert value 0 or 1 using 8 bits.
 **************************************************************************/
-int dio_put_bool8_raw(struct raw_data_out *dout, bool value)
+int dio_put_bool8_raw(struct raw_data_out *d_out, bool value)
 {
   FIELD_RANGE_TEST(value != TRUE && value != FALSE,
                    value = (value != FALSE);,
                    "Trying to put a non-boolean: %d", (int) value);
 
-  return dio_put_uint8_raw(dout, value ? 1 : 0);
+  return dio_put_uint8_raw(d_out, value ? 1 : 0);
 }
 
 /**********************************************************************//**
   Insert value 0 or 1 using 32 bits.
 **************************************************************************/
-int dio_put_bool32_raw(struct raw_data_out *dout, bool value)
+int dio_put_bool32_raw(struct raw_data_out *d_out, bool value)
 {
   FIELD_RANGE_TEST(value != TRUE && value != FALSE,
                    value = (value != FALSE);,
                    "Trying to put a non-boolean: %d",
                    (int) value);
 
-  return dio_put_uint32_raw(dout, value ? 1 : 0);
+  return dio_put_uint32_raw(d_out, value ? 1 : 0);
 }
 
 /**********************************************************************//**
   Insert a float number, which is multiplied by 'float_factor' before
   being encoded into an uint32.
 **************************************************************************/
-int dio_put_ufloat_raw(struct raw_data_out *dout, float value, int float_factor)
+int dio_put_ufloat_raw(struct raw_data_out *d_out, float value,
+                       int float_factor)
 {
   uint32_t v = value * float_factor;
 
@@ -419,14 +423,15 @@ int dio_put_ufloat_raw(struct raw_data_out *dout, float value, int float_factor)
                    value, float_factor, (float) v / float_factor,
                    fabsf((float) v / float_factor - value) * float_factor);
 
-  return dio_put_uint32_raw(dout, v);
+  return dio_put_uint32_raw(d_out, v);
 }
 
 /**********************************************************************//**
   Insert a float number, which is multiplied by 'float_factor' before
   being encoded into a sint32.
 **************************************************************************/
-int dio_put_sfloat_raw(struct raw_data_out *dout, float value, int float_factor)
+int dio_put_sfloat_raw(struct raw_data_out *d_out, float value,
+                       int float_factor)
 {
   int32_t v = value * float_factor;
 
@@ -436,7 +441,7 @@ int dio_put_sfloat_raw(struct raw_data_out *dout, float value, int float_factor)
                    value, float_factor, (float) v / float_factor,
                    fabsf((float) v / float_factor - value) * float_factor);
 
-  return dio_put_sint32_raw(dout, v);
+  return dio_put_sint32_raw(d_out, v);
 }
 
 /**********************************************************************//**
@@ -444,7 +449,8 @@ int dio_put_sfloat_raw(struct raw_data_out *dout, float value, int float_factor)
   insert values using 8 bits for each. stop_value is not required to
   fit in 8 bits. Actual values may overflow.
 **************************************************************************/
-int dio_put_uint8_vec8_raw(struct raw_data_out *dout, int *values, int stop_value)
+int dio_put_uint8_vec8_raw(struct raw_data_out *d_out, int *values,
+                           int stop_value)
 {
   size_t count;
   int e = 0;
@@ -453,13 +459,13 @@ int dio_put_uint8_vec8_raw(struct raw_data_out *dout, int *values, int stop_valu
     /* nothing */
   }
 
-  if (enough_space(dout, 1 + count)) {
+  if (enough_space(d_out, 1 + count)) {
     size_t i;
 
-    e |= dio_put_uint8_raw(dout, count);
+    e |= dio_put_uint8_raw(d_out, count);
 
     for (i = 0; i < count; i++) {
-      e |= dio_put_uint8_raw(dout, values[i]);
+      e |= dio_put_uint8_raw(d_out, values[i]);
     }
   }
 
@@ -471,7 +477,8 @@ int dio_put_uint8_vec8_raw(struct raw_data_out *dout, int *values, int stop_valu
   insert values using 16 bits for each. stop_value is not required to
   fit in 16 bits. Actual values may overflow.
 **************************************************************************/
-int dio_put_uint16_vec8_raw(struct raw_data_out *dout, int *values, int stop_value)
+int dio_put_uint16_vec8_raw(struct raw_data_out *d_out, int *values,
+                            int stop_value)
 {
   size_t count;
   int e = 0;
@@ -480,13 +487,13 @@ int dio_put_uint16_vec8_raw(struct raw_data_out *dout, int *values, int stop_val
     /* nothing */
   }
 
-  if (enough_space(dout, 1 + 2 * count)) {
+  if (enough_space(d_out, 1 + 2 * count)) {
     size_t i;
 
-    e |= dio_put_uint8_raw(dout, count);
+    e |= dio_put_uint8_raw(d_out, count);
 
     for (i = 0; i < count; i++) {
-      e |= dio_put_uint16_raw(dout, values[i]);
+      e |= dio_put_uint16_raw(d_out, values[i]);
     }
   }
 
@@ -496,11 +503,12 @@ int dio_put_uint16_vec8_raw(struct raw_data_out *dout, int *values, int stop_val
 /**********************************************************************//**
   Insert block directly from memory.
 **************************************************************************/
-int dio_put_memory_raw(struct raw_data_out *dout, const void *value, size_t size)
+int dio_put_memory_raw(struct raw_data_out *d_out, const void *value,
+                       size_t size)
 {
-  if (enough_space(dout, size)) {
-    memcpy(ADD_TO_POINTER(dout->dest, dout->current), value, size);
-    dout->current += size;
+  if (enough_space(d_out, size)) {
+    memcpy(ADD_TO_POINTER(d_out->dest, d_out->current), value, size);
+    d_out->current += size;
   }
 
   return 0;
@@ -509,7 +517,7 @@ int dio_put_memory_raw(struct raw_data_out *dout, const void *value, size_t size
 /**********************************************************************//**
   Insert nullptr-terminated string. Conversion callback is used if set.
 **************************************************************************/
-int dio_put_string_raw(struct raw_data_out *dout, const char *value)
+int dio_put_string_raw(struct raw_data_out *d_out, const char *value)
 {
   if (put_conv_callback) {
     size_t length;
@@ -517,39 +525,39 @@ int dio_put_string_raw(struct raw_data_out *dout, const char *value)
     int e = 0;
 
     if ((buffer = (*put_conv_callback) (value, &length))) {
-      e = dio_put_memory_raw(dout, buffer, length + 1);
+      e = dio_put_memory_raw(d_out, buffer, length + 1);
       free(buffer);
     }
 
     return e;
   } else {
-    return dio_put_memory_raw(dout, value, strlen(value) + 1);
+    return dio_put_memory_raw(d_out, value, strlen(value) + 1);
   }
 }
 
 /**********************************************************************//**
   Insert cm_parameter struct.
 **************************************************************************/
-int dio_put_cm_parameter_raw(struct raw_data_out *dout,
+int dio_put_cm_parameter_raw(struct raw_data_out *d_out,
                              const struct cm_parameter *param)
 {
   int i;
   int e = 0;
 
   for (i = 0; i < O_LAST; i++) {
-    e |= dio_put_sint16_raw(dout, param->minimal_surplus[i]);
+    e |= dio_put_sint16_raw(d_out, param->minimal_surplus[i]);
   }
 
-  e |= dio_put_bool8_raw(dout, param->max_growth);
-  e |= dio_put_bool8_raw(dout, param->require_happy);
-  e |= dio_put_bool8_raw(dout, param->allow_disorder);
-  e |= dio_put_bool8_raw(dout, param->allow_specialists);
+  e |= dio_put_bool8_raw(d_out, param->max_growth);
+  e |= dio_put_bool8_raw(d_out, param->require_happy);
+  e |= dio_put_bool8_raw(d_out, param->allow_disorder);
+  e |= dio_put_bool8_raw(d_out, param->allow_specialists);
 
   for (i = 0; i < O_LAST; i++) {
-    e |= dio_put_uint16_raw(dout, param->factor[i]);
+    e |= dio_put_uint16_raw(d_out, param->factor[i]);
   }
 
-  e |= dio_put_uint16_raw(dout, param->happy_factor);
+  e |= dio_put_uint16_raw(d_out, param->happy_factor);
 
   return e;
 }
@@ -557,17 +565,17 @@ int dio_put_cm_parameter_raw(struct raw_data_out *dout,
 /**********************************************************************//**
   Insert the given unit_order struct/
 **************************************************************************/
-int dio_put_unit_order_raw(struct raw_data_out *dout,
+int dio_put_unit_order_raw(struct raw_data_out *d_out,
                            const struct unit_order *order)
 {
   int e = 0;
 
-  e |= dio_put_uint8_raw(dout, order->order);
-  e |= dio_put_uint8_raw(dout, order->activity);
-  e |= dio_put_sint32_raw(dout, order->target);
-  e |= dio_put_sint16_raw(dout, order->sub_target);
-  e |= dio_put_uint8_raw(dout, order->action);
-  e |= dio_put_sint8_raw(dout, order->dir);
+  e |= dio_put_uint8_raw(d_out, order->order);
+  e |= dio_put_uint8_raw(d_out, order->activity);
+  e |= dio_put_sint32_raw(d_out, order->target);
+  e |= dio_put_sint16_raw(d_out, order->sub_target);
+  e |= dio_put_uint8_raw(d_out, order->action);
+  e |= dio_put_sint8_raw(d_out, order->dir);
 
   return e;
 }
@@ -576,17 +584,17 @@ int dio_put_unit_order_raw(struct raw_data_out *dout,
   Insert number of worklist items as 8 bit value and then insert
   8 bit kind and 8 bit number for each worklist item.
 **************************************************************************/
-int dio_put_worklist_raw(struct raw_data_out *dout, const struct worklist *pwl)
+int dio_put_worklist_raw(struct raw_data_out *d_out, const struct worklist *pwl)
 {
   int i, length = worklist_length(pwl);
   int e = 0;
 
-  e |= dio_put_uint8_raw(dout, length);
+  e |= dio_put_uint8_raw(d_out, length);
   for (i = 0; i < length; i++) {
     const struct universal *pcp = &(pwl->entries[i]);
 
-    e |= dio_put_uint8_raw(dout, pcp->kind);
-    e |= dio_put_uint8_raw(dout, universal_number(pcp));
+    e |= dio_put_uint8_raw(d_out, pcp->kind);
+    e |= dio_put_uint8_raw(d_out, universal_number(pcp));
   }
 
   return e;
@@ -1035,13 +1043,13 @@ bool dio_get_action_probability_raw(struct data_in *din,
 /**********************************************************************//**
   Serialize an action probability.
 **************************************************************************/
-int dio_put_action_probability_raw(struct raw_data_out *dout,
+int dio_put_action_probability_raw(struct raw_data_out *d_out,
                                    const struct act_prob *aprob)
 {
   int e = 0;
 
-  e |= dio_put_uint8_raw(dout, aprob->min);
-  e |= dio_put_uint8_raw(dout, aprob->max);
+  e |= dio_put_uint8_raw(d_out, aprob->min);
+  e |= dio_put_uint8_raw(d_out, aprob->max);
 
   return e;
 }
@@ -1075,7 +1083,7 @@ bool dio_get_requirement_raw(struct data_in *din, struct requirement *preq)
 /**********************************************************************//**
   Serialize a requirement.
 **************************************************************************/
-int dio_put_requirement_raw(struct raw_data_out *dout,
+int dio_put_requirement_raw(struct raw_data_out *d_out,
                             const struct requirement *preq)
 {
   int type, range, value;
@@ -1084,12 +1092,12 @@ int dio_put_requirement_raw(struct raw_data_out *dout,
 
   req_get_values(preq, &type, &range, &survives, &present, &quiet, &value);
 
-  e |= dio_put_uint8_raw(dout, type);
-  e |= dio_put_sint32_raw(dout, value);
-  e |= dio_put_uint8_raw(dout, range);
-  e |= dio_put_bool8_raw(dout, survives);
-  e |= dio_put_bool8_raw(dout, present);
-  e |= dio_put_bool8_raw(dout, quiet);
+  e |= dio_put_uint8_raw(d_out, type);
+  e |= dio_put_sint32_raw(d_out, value);
+  e |= dio_put_uint8_raw(d_out, range);
+  e |= dio_put_bool8_raw(d_out, survives);
+  e |= dio_put_bool8_raw(d_out, present);
+  e |= dio_put_bool8_raw(d_out, quiet);
 
   return e;
 }
diff --git a/common/networking/dataio_raw.h b/common/networking/dataio_raw.h
index 65fedead90..f3a5ee203e 100644
--- a/common/networking/dataio_raw.h
+++ b/common/networking/dataio_raw.h
@@ -99,12 +99,12 @@ bool dataio_get_conv_callback(char *dst, size_t ndst, const char *src,
                               size_t nsrc);
 
 /* General functions */
-void dio_output_init(struct raw_data_out *dout, void *destination,
+void dio_output_init(struct raw_data_out *d_out, void *destination,
                      size_t dest_size);
-void dio_output_rewind(struct raw_data_out *dout);
-size_t dio_output_used(struct raw_data_out *dout);
+void dio_output_rewind(struct raw_data_out *d_out);
+size_t dio_output_used(struct raw_data_out *d_out);
 
-void dio_input_init(struct data_in *dout, const void *src, size_t src_size);
+void dio_input_init(struct data_in *d_out, const void *src, size_t src_size);
 void dio_input_rewind(struct data_in *din);
 size_t dio_input_remaining(struct data_in *din);
 bool dio_input_skip(struct data_in *din, size_t size);
@@ -176,41 +176,48 @@ bool dio_get_uint16_vec8_raw(struct data_in *din, int **values, int stop_value)
 
 #endif /* FREECIV_JSON_CONNECTION */
 
-/* puts */
-int dio_put_type_raw(struct raw_data_out *dout, enum data_type type, int value);
-
-int dio_put_uint8_raw(struct raw_data_out *dout, int value);
-int dio_put_uint16_raw(struct raw_data_out *dout, int value);
-int dio_put_uint32_raw(struct raw_data_out *dout, int value);
-
-int dio_put_sint8_raw(struct raw_data_out *dout, int value);
-int dio_put_sint16_raw(struct raw_data_out *dout, int value);
-int dio_put_sint32_raw(struct raw_data_out *dout, int value);
-
-int dio_put_bool8_raw(struct raw_data_out *dout, bool value);
-int dio_put_bool32_raw(struct raw_data_out *dout, bool value);
-int dio_put_ufloat_raw(struct raw_data_out *dout, float value, int float_factor);
-int dio_put_sfloat_raw(struct raw_data_out *dout, float value, int float_factor);
-
-int dio_put_memory_raw(struct raw_data_out *dout, const void *value, size_t size);
-int dio_put_string_raw(struct raw_data_out *dout, const char *value);
-int dio_put_cm_parameter_raw(struct raw_data_out *dout,
+/* Puts */
+int dio_put_type_raw(struct raw_data_out *d_out, enum data_type type,
+                     int value);
+
+int dio_put_uint8_raw(struct raw_data_out *d_out, int value);
+int dio_put_uint16_raw(struct raw_data_out *d_out, int value);
+int dio_put_uint32_raw(struct raw_data_out *d_out, int value);
+
+int dio_put_sint8_raw(struct raw_data_out *d_out, int value);
+int dio_put_sint16_raw(struct raw_data_out *d_out, int value);
+int dio_put_sint32_raw(struct raw_data_out *d_out, int value);
+
+int dio_put_bool8_raw(struct raw_data_out *d_out, bool value);
+int dio_put_bool32_raw(struct raw_data_out *d_out, bool value);
+int dio_put_ufloat_raw(struct raw_data_out *d_out, float value,
+                       int float_factor);
+int dio_put_sfloat_raw(struct raw_data_out *d_out, float value,
+                       int float_factor);
+
+int dio_put_memory_raw(struct raw_data_out *d_out, const void *value,
+                       size_t size);
+int dio_put_string_raw(struct raw_data_out *d_out, const char *value);
+int dio_put_cm_parameter_raw(struct raw_data_out *d_out,
                              const struct cm_parameter *param);
-int dio_put_worklist_raw(struct raw_data_out *dout, const struct worklist *pwl);
-int dio_put_unit_order_raw(struct raw_data_out *dout,
+int dio_put_worklist_raw(struct raw_data_out *d_out, const struct worklist *pwl);
+int dio_put_unit_order_raw(struct raw_data_out *d_out,
                            const struct unit_order *order);
-int dio_put_requirement_raw(struct raw_data_out *dout, const struct requirement *preq);
-int dio_put_action_probability_raw(struct raw_data_out *dout,
+int dio_put_requirement_raw(struct raw_data_out *d_out,
+                            const struct requirement *preq);
+int dio_put_action_probability_raw(struct raw_data_out *d_out,
                                    const struct act_prob *aprob);
 
-int dio_put_uint8_vec8_raw(struct raw_data_out *dout, int *values, int stop_value);
-int dio_put_uint16_vec8_raw(struct raw_data_out *dout, int *values, int stop_value);
+int dio_put_uint8_vec8_raw(struct raw_data_out *d_out, int *values,
+                           int stop_value);
+int dio_put_uint16_vec8_raw(struct raw_data_out *d_out, int *values,
+                            int stop_value);
 
 #ifndef FREECIV_JSON_CONNECTION
 
 /* Should be a function but we need some macro magic. */
-#define DIO_BV_PUT(pdout, location, bv)               \
-  dio_put_memory_raw((pdout), (bv).vec, sizeof((bv).vec))
+#define DIO_BV_PUT(pd_out, location, bv)               \
+  dio_put_memory_raw((pd_out), (bv).vec, sizeof((bv).vec))
 
 #define DIO_PUT(f, d, l, ...) dio_put_##f##_raw(d, ## __VA_ARGS__)
 
diff --git a/common/networking/packets.c b/common/networking/packets.c
index ff2cac82c3..bda2fd8df1 100644
--- a/common/networking/packets.c
+++ b/common/networking/packets.c
@@ -139,7 +139,7 @@ static bool conn_compression_flush(struct connection *pconn)
 
   compressed_packet_len = compressed_size + (jumbo ? 6 : 2);
   if (compressed_packet_len < pconn->compression.queue.size) {
-    struct raw_data_out dout;
+    struct raw_data_out d_out;
 
     log_compress("COMPRESS: compressed %lu bytes to %ld (level %d)",
                  (unsigned long) pconn->compression.queue.size,
@@ -155,8 +155,8 @@ static bool conn_compression_flush(struct connection *pconn)
 
       log_compress("COMPRESS: sending %ld as normal", compressed_size);
 
-      dio_output_init(&dout, header, sizeof(header));
-      dio_put_uint16_raw(&dout, 2 + compressed_size + COMPRESSION_BORDER);
+      dio_output_init(&d_out, header, sizeof(header));
+      dio_put_uint16_raw(&d_out, 2 + compressed_size + COMPRESSION_BORDER);
       connection_send_data(pconn, header, sizeof(header));
       connection_send_data(pconn, compressed, compressed_size);
     } else {
@@ -166,9 +166,9 @@ static bool conn_compression_flush(struct connection *pconn)
                        compressed_normal_jumbo_packet_len_overlap);
 
       log_compress("COMPRESS: sending %ld as jumbo", compressed_size);
-      dio_output_init(&dout, header, sizeof(header));
-      dio_put_uint16_raw(&dout, JUMBO_SIZE);
-      dio_put_uint32_raw(&dout, 6 + compressed_size);
+      dio_output_init(&d_out, header, sizeof(header));
+      dio_put_uint16_raw(&d_out, JUMBO_SIZE);
+      dio_put_uint32_raw(&d_out, 6 + compressed_size);
       connection_send_data(pconn, header, sizeof(header));
       connection_send_data(pconn, compressed, compressed_size);
     }
diff --git a/common/networking/packets.h b/common/networking/packets.h
index 33e8c43fb3..8ae757f83d 100644
--- a/common/networking/packets.h
+++ b/common/networking/packets.h
@@ -131,19 +131,19 @@ void packets_deinit(void);
 
 #define SEND_PACKET_START(packet_type) \
   unsigned char buffer[MAX_LEN_PACKET]; \
-  struct raw_data_out dout; \
+  struct raw_data_out d_out; \
   \
-  dio_output_init(&dout, buffer, sizeof(buffer)); \
-  dio_put_type_raw(&dout, pc->packet_header.length, 0); \
-  dio_put_type_raw(&dout, pc->packet_header.type, packet_type);
+  dio_output_init(&d_out, buffer, sizeof(buffer)); \
+  dio_put_type_raw(&d_out, pc->packet_header.length, 0); \
+  dio_put_type_raw(&d_out, pc->packet_header.type, packet_type);
 
 #define SEND_PACKET_END(packet_type) \
   { \
-    size_t size = dio_output_used(&dout); \
+    size_t size = dio_output_used(&d_out); \
     \
-    dio_output_rewind(&dout); \
-    dio_put_type_raw(&dout, pc->packet_header.length, size); \
-    fc_assert(!dout.too_short); \
+    dio_output_rewind(&d_out); \
+    dio_put_type_raw(&d_out, pc->packet_header.length, size); \
+    fc_assert(!d_out.too_short); \
     return send_packet_data(pc, buffer, size, packet_type); \
   }
 
diff --git a/common/networking/packets_json.h b/common/networking/packets_json.h
index 2fc08f487e..f658d95d78 100644
--- a/common/networking/packets_json.h
+++ b/common/networking/packets_json.h
@@ -28,51 +28,51 @@ void *get_packet_from_connection_json(struct connection *pc,
   unsigned char buffer[MAX_LEN_PACKET * 5];                             \
   struct plocation *pid_addr;                                           \
   char *json_buffer = nullptr;                                          \
-  struct json_data_out dout;                                            \
-  dio_output_init(&(dout.raw), buffer, sizeof(buffer));                 \
+  struct json_data_out d_out;                                           \
+  dio_output_init(&(d_out.raw), buffer, sizeof(buffer));                \
   if (pc->json_mode) {                                                  \
-    dout.json = json_object();                                          \
-    dio_put_uint16_raw(&(dout.raw), 0);                                 \
+    d_out.json = json_object();                                         \
+    dio_put_uint16_raw(&(d_out.raw), 0);                                \
     pid_addr = plocation_field_new("pid");                              \
-    dio_put_uint8_json(&dout, pid_addr, packet_type);                   \
+    dio_put_uint8_json(&d_out, pid_addr, packet_type);                  \
     FC_FREE(pid_addr);                                                  \
   } else {                                                              \
-    dout.json = nullptr;                                                \
-    dio_put_type_raw(&dout.raw, pc->packet_header.length, 0);           \
-    dio_put_type_raw(&dout.raw, pc->packet_header.type, packet_type);   \
+    d_out.json = nullptr;                                               \
+    dio_put_type_raw(&d_out.raw, pc->packet_header.length, 0);          \
+    dio_put_type_raw(&d_out.raw, pc->packet_header.type, packet_type);  \
   }
 
 #define SEND_PACKET_END(packet_type) \
   {                                                                     \
     size_t size;                                                        \
     if (pc->json_mode) {                                                \
-      json_buffer = json_dumps(dout.json, JSON_COMPACT | JSON_ENSURE_ASCII); \
+      json_buffer = json_dumps(d_out.json, JSON_COMPACT | JSON_ENSURE_ASCII); \
       if (json_buffer) {                                                \
-        dio_put_string_raw(&(dout.raw), json_buffer);                   \
+        dio_put_string_raw(&(d_out.raw), json_buffer);                  \
         log_packet_json("Json out: %s", json_buffer);                   \
       }                                                                 \
-      size = dio_output_used(&dout.raw);                                \
+      size = dio_output_used(&d_out.raw);                               \
                                                                         \
-      dio_output_rewind(&(dout.raw));                                   \
-      dio_put_uint16_raw(&(dout.raw), size);                            \
+      dio_output_rewind(&(d_out.raw));                                  \
+      dio_put_uint16_raw(&(d_out.raw), size);                           \
       free(json_buffer);                                                \
-      json_decref(dout.json);                                           \
+      json_decref(d_out.json);                                          \
     } else {                                                            \
-      size = dio_output_used(&dout.raw);                                \
+      size = dio_output_used(&d_out.raw);                               \
                                                                         \
-      dio_output_rewind(&dout.raw);                                     \
-      dio_put_type_raw(&dout.raw, pc->packet_header.length, size);      \
+      dio_output_rewind(&d_out.raw);                                    \
+      dio_put_type_raw(&d_out.raw, pc->packet_header.length, size);     \
     }                                                                   \
-    fc_assert(!dout.raw.too_short);                                     \
+    fc_assert(!d_out.raw.too_short);                                    \
     return send_packet_data(pc, buffer, size, packet_type);             \
   }
 
-#define SEND_PACKET_DISCARD() \
-  {                           \
-    if (pc->json_mode) {      \
-      json_decref(dout.json); \
-    }                         \
-    return 0;                 \
+#define SEND_PACKET_DISCARD()  \
+  {                            \
+    if (pc->json_mode) {       \
+      json_decref(d_out.json); \
+    }                          \
+    return 0;                  \
   }
 
 #define RECEIVE_PACKET_START(packet_type, result)                           \
-- 
2.53.0

