[Freeciv-Dev] Re: (PR#10983) Win32 server crash
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10983 >
And a patch.
? diff
Index: common/unit.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.h,v
retrieving revision 1.126.2.2
diff -u -r1.126.2.2 unit.h
--- common/unit.h 18 Oct 2004 22:40:33 -0000 1.126.2.2
+++ common/unit.h 11 Nov 2004 23:21:15 -0000
@@ -182,9 +182,9 @@
#define SPECLIST_TYPE struct unit
#include "speclist.h"
-#define unit_list_iterate(unitlist, punit) \
+#define unit_list_iterate_unsafe(unitlist, punit) \
TYPED_LIST_ITERATE(struct unit, unitlist, punit)
-#define unit_list_iterate_end LIST_ITERATE_END
+#define unit_list_iterate_unsafe_end LIST_ITERATE_END
#define SINGLE_MOVE 3
#define MOVE_COST_RIVER 1
#define MOVE_COST_RAIL 0
@@ -197,9 +197,9 @@
if (_size > 0) { \
int _ids[_size]; \
int _i = 0; \
- unit_list_iterate(unitlist, punit) { \
+ unit_list_iterate_unsafe(unitlist, punit) { \
_ids[_i++] = punit->id; \
- } unit_list_iterate_end; \
+ } unit_list_iterate_unsafe_end; \
for (_i=0; _i<_size; _i++) { \
struct unit *punit = find_unit_by_id(_ids[_i]); \
if (punit) { \
@@ -210,6 +210,9 @@
} \
}
+#define unit_list_iterate unit_list_iterate_safe
+#define unit_list_iterate_end unit_list_iterate_safe_end
+
struct unit *unit_list_find(struct unit_list *This, int id);
void unit_list_sort_ord_map(struct unit_list *This);
|
|