[Freeciv-Dev] (PR#39566) worklist_iterate

2007-08-14 Thread Pepeto _

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39566 

About, worklist.h, line 59:
Because of an argument of the macro is named worklist, you cannot use
struct worklist. Or it will give some like:
worklist_iterate(pcity-worklist, prod) {

{
  struct pcity-worklist *_worklist = (pcity-worklist)

Funny, but cannot compile...


/* Iterate over all entries in the worklist. */
#define worklist_iterate(worklist, prod)\
{   \
  struct worklist *_worklist = (worklist);  \
  int _iter, _length = worklist_length(_worklist);  \
  struct city_production prod;  \
\
  for (_iter = 0; _iter  _length; _iter++) {   \
worklist_peek_ith(_worklist, prod, _iter);


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39566) worklist_iterate

2007-08-14 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39566 

On 14/08/07, Pepeto _ [EMAIL PROTECTED] wrote:

 About, worklist.h, line 59:
 Because of an argument of the macro is named worklist, you cannot use
 struct worklist. Or it will give some like:

 Thanks.
 All users seem to use worklist named worklist, which of course
again works (even if I'm not big fan of naming structures and their
instances with the same name).

 Attached is patch for S2_1.
 In trunk we have different macro which has doesn't have this issue.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/worklist.h freeciv/common/worklist.h
--- freeciv/common/worklist.h	2007-03-05 19:14:29.0 +0200
+++ freeciv/common/worklist.h	2007-08-14 15:40:00.0 +0300
@@ -57,9 +57,9 @@
   fc__attribute((__format__ (__printf__, 4, 5)));
 
 /* Iterate over all entries in the worklist. */
-#define worklist_iterate(worklist, prod)\
+#define worklist_iterate(wl, prod)  \
 {	\
-  struct worklist *_worklist = (worklist);\
+  struct worklist *_worklist = (wl);\
   int _iter, _length = worklist_length(_worklist);			\
   struct city_production prod;		\
 	\
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev