Author: sveinung
Date: Sun Apr 19 16:21:30 2015
New Revision: 28813

URL: http://svn.gna.org/viewcvs/freeciv?rev=28813&view=rev
Log:
JSON protocol: Remove special dio_* functions for arrays.

An old implementation of JSON arrays required a dio_* function for each
combination of array level and data type.

See patch #6010

Modified:
    trunk/common/dataio_json.c
    trunk/common/dataio_json.h

Modified: trunk/common/dataio_json.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/dataio_json.c?rev=28813&r1=28812&r2=28813&view=diff
==============================================================================
--- trunk/common/dataio_json.c  (original)
+++ trunk/common/dataio_json.c  Sun Apr 19 16:21:30 2015
@@ -155,97 +155,6 @@
 }
 
 /**************************************************************************
-...
-**************************************************************************/
-void dio_put_array_uint8_json(struct json_data_out *dout, char *key,
-                              int *values, int size)
-{
-  int i;
-  json_t *array = json_array();
-  for (i = 0; i < size; i++) {
-    json_array_append_new(array, json_integer(values[i]));
-  }
-  
-  json_object_set_new(dout->json, key, array);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void dio_put_array_uint32_json(struct json_data_out *dout, char *key,
-                               int *values, int size)
-{
-  int i;
-  json_t *array = json_array();
-
-  for (i = 0; i < size; i++) {
-    json_array_append_new(array, json_integer(values[i]));
-  }
-  
-  json_object_set_new(dout->json, key, array);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void dio_put_array_sint8_json(struct json_data_out *dout, char *key,
-                              int *values, int size)
-{
-  int i;
-  json_t *array = json_array();
-  for (i = 0; i < size; i++) {
-    json_array_append_new(array, json_integer(values[i]));
-  }
-  
-  json_object_set_new(dout->json, key, array);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void dio_put_array_sint16_json(struct json_data_out *dout, char *key,
-                               int *values, int size)
-{
-  int i;
-  json_t *array = json_array();
-  for (i = 0; i < size; i++) {
-    json_array_append_new(array, json_integer(values[i]));
-  }
-  
-  json_object_set_new(dout->json, key, array);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void dio_put_array_sint32_json(struct json_data_out *dout, char *key,
-                               int *values, int size)
-{
-  int i;
-  json_t *array = json_array();
-  for (i = 0; i < size; i++) {
-    json_array_append_new(array, json_integer(values[i]));
-  }
-  
-  json_object_set_new(dout->json, key, array);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-void dio_put_array_bool8_json(struct json_data_out *dout, char *key,
-                              bool *values, int size)
-{
-  int i;
-  json_t *array = json_array();
-  for (i = 0; i < size; i++) {
-    json_array_append_new(array, values[i] ? json_true() : json_false());
-  }
-  
-  json_object_set_new(dout->json, key, array);
-}
-
-/**************************************************************************
  Receive uint8 value to dest with json.
 **************************************************************************/
 bool dio_get_uint8_json(json_t *json_packet, char *key, int *dest)
@@ -505,24 +414,6 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void dio_put_string_array_json(struct json_data_out *dout, char *key, 
-                               const char *value, int size)
-{
-  int i;
-
-  json_t *array = json_array();
-  for (i = 0; i < size; i++) {
-    if (value != NULL) {
-      json_array_append_new(array, json_string(value + i));
-    }
-  }
-  
-  json_object_set_new(dout->json, key, array);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
 void dio_put_tech_list_json(struct json_data_out *dout, char *key, const int 
*value)
 {
   /* TODO: implement */

Modified: trunk/common/dataio_json.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/dataio_json.h?rev=28813&r1=28812&r2=28813&view=diff
==============================================================================
--- trunk/common/dataio_json.h  (original)
+++ trunk/common/dataio_json.h  Sun Apr 19 16:21:30 2015
@@ -84,13 +84,6 @@
 void dio_put_uint16_json(struct json_data_out *dout, char *key, int value);
 void dio_put_uint32_json(struct json_data_out *dout, char *key, int value);
 
-void dio_put_array_uint8_json(struct json_data_out *dout, char *key, int 
*values, int size);
-void dio_put_array_uint32_json(struct json_data_out *dout, char *key, int 
*values, int size);
-void dio_put_array_sint8_json(struct json_data_out *dout, char *key, int 
*values, int size);
-void dio_put_array_sint16_json(struct json_data_out *dout, char *key, int 
*values, int size);
-void dio_put_array_sint32_json(struct json_data_out *dout, char *key, int 
*values, int size);
-void dio_put_array_bool8_json(struct json_data_out *dout, char *key, bool 
*values, int size);
-
 #define dio_put_sint8_json(d,k,v) dio_put_uint8_json(d,k,v)
 #define dio_put_sint16_json(d,k,v) dio_put_uint16_json(d,k,v)
 #define dio_put_sint32_json(d,k,v) dio_put_uint32_json(d,k,v)
@@ -112,7 +105,6 @@
 
 void dio_put_uint8_vec8_json(struct json_data_out *dout, char *key, int 
*values, int stop_value);
 void dio_put_uint16_vec8_json(struct json_data_out *dout, char *key, int 
*values, int stop_value);
-void dio_put_string_array_json(struct json_data_out *dout, char *key, const 
char *value, int size);
 
 /* Should be a function but we need some macro magic. */
 #define DIO_BV_PUT(pdout, type, bv) \


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to