Author: cazfi
Date: Fri Jul 29 01:43:38 2016
New Revision: 33366

URL: http://svn.gna.org/viewcvs/freeciv?rev=33366&view=rev
Log:
Reworked cf_int_seq() so related code compiles with tcc

See patch #7509

Modified:
    branches/S2_6/common/game.c
    branches/S2_6/utility/shared.h

Modified: branches/S2_6/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/game.c?rev=33366&r1=33365&r2=33366&view=diff
==============================================================================
--- branches/S2_6/common/game.c (original)
+++ branches/S2_6/common/game.c Fri Jul 29 01:43:38 2016
@@ -781,10 +781,12 @@
   struct cf_sequence sequences[] = {
     cf_str_seq('R', (reason == NULL) ? "auto" : reason),
     cf_str_seq('S', year_suffix()),
-    cf_int_seq('T', game.info.turn),
-    cf_int_seq('Y', game.info.year),
+    { 0 }, { 0 }, /* Works for both gcc and tcc */
     cf_end()
   };
+
+  cf_int_seq('T', game.info.turn, &sequences[2]);
+  cf_int_seq('Y', game.info.year, &sequences[3]);
 
   fc_vsnprintcf(buf, buflen, format, sequences, -1);
 

Modified: branches/S2_6/utility/shared.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/shared.h?rev=33366&r1=33365&r2=33366&view=diff
==============================================================================
--- branches/S2_6/utility/shared.h      (original)
+++ branches/S2_6/utility/shared.h      Fri Jul 29 01:43:38 2016
@@ -279,7 +279,7 @@
 static inline struct cf_sequence cf_bool_seq(char letter, bool value);
 static inline struct cf_sequence cf_trans_bool_seq(char letter, bool value);
 static inline struct cf_sequence cf_char_seq(char letter, char value);
-static inline struct cf_sequence cf_int_seq(char letter, int value);
+static inline void cf_int_seq(char letter, int value, struct cf_sequence *out);
 static inline struct cf_sequence cf_hexa_seq(char letter, int value);
 static inline struct cf_sequence cf_float_seq(char letter, float value);
 static inline struct cf_sequence cf_ptr_seq(char letter, const void *value);
@@ -358,11 +358,21 @@
 /****************************************************************************
   Build an argument for fc_snprintcf() of integer type (%d).
 ****************************************************************************/
-static inline struct cf_sequence cf_int_seq(char letter, int value)
-{
-  struct cf_sequence sequence;
-
-  sequence.type = CF_INTEGER;
+static inline void cf_int_seq(char letter, int value, struct cf_sequence *out)
+{
+  out->type = CF_INTEGER;
+  out->letter = letter;
+  out->int_value = value;
+}
+
+/****************************************************************************
+  Build an argument for fc_snprintcf() of hexadecimal type (%x).
+****************************************************************************/
+static inline struct cf_sequence cf_hexa_seq(char letter, int value)
+{
+  struct cf_sequence sequence;
+
+  sequence.type = CF_HEXA;
   sequence.letter = letter;
   sequence.int_value = value;
 
@@ -370,20 +380,6 @@
 }
 
 /****************************************************************************
-  Build an argument for fc_snprintcf() of hexadecimal type (%x).
-****************************************************************************/
-static inline struct cf_sequence cf_hexa_seq(char letter, int value)
-{
-  struct cf_sequence sequence;
-
-  sequence.type = CF_HEXA;
-  sequence.letter = letter;
-  sequence.int_value = value;
-
-  return sequence;
-}
-
-/****************************************************************************
   Build an argument for fc_snprintcf() of float type (%f).
 ****************************************************************************/
 static inline struct cf_sequence cf_float_seq(char letter, float value)


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

Reply via email to