Author: cazfi
Date: Sat Jul 30 14:55:39 2016
New Revision: 33383

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

See patch #7509

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

Modified: branches/S2_5/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/game.c?rev=33383&r1=33382&r2=33383&view=diff
==============================================================================
--- branches/S2_5/common/game.c (original)
+++ branches/S2_5/common/game.c Sat Jul 30 14:55:39 2016
@@ -755,10 +755,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_5/utility/shared.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/shared.h?rev=33383&r1=33382&r2=33383&view=diff
==============================================================================
--- branches/S2_5/utility/shared.h      (original)
+++ branches/S2_5/utility/shared.h      Sat Jul 30 14:55:39 2016
@@ -254,7 +254,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);
@@ -333,11 +333,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;
 
@@ -345,20 +355,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