Author: cazfi Date: Fri Jul 29 01:43:31 2016 New Revision: 33365 URL: http://svn.gna.org/viewcvs/freeciv?rev=33365&view=rev Log: Reworked cf_int_seq() so related code compiles with tcc
See patch #7509 Modified: trunk/common/game.c trunk/utility/shared.h Modified: trunk/common/game.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/game.c?rev=33365&r1=33364&r2=33365&view=diff ============================================================================== --- trunk/common/game.c (original) +++ trunk/common/game.c Fri Jul 29 01:43:31 2016 @@ -789,10 +789,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: trunk/utility/shared.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/shared.h?rev=33365&r1=33364&r2=33365&view=diff ============================================================================== --- trunk/utility/shared.h (original) +++ trunk/utility/shared.h Fri Jul 29 01:43:31 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