[Freeciv-Dev] (PR#13951) bug with E_NOEVENT patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13951 >
In some compilations (only with optimization, for me) the client always
crashes.
It appears this happens because E_NOEVENT was removed. This causes the
event enum to be unsigned or smaller so the -1 value used for the event
array terminator no longer passes the <0 check. Oddly, this doesn't
cause a compiler warning despite being an impossible check.
This patch fixes the terminator. I will commit immediately.
-jason
Index: common/events.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/events.c,v
retrieving revision 1.4
diff -p -u -r1.4 events.c
--- common/events.c 4 Sep 2005 03:03:43 -0000 1.4
+++ common/events.c 13 Sep 2005 08:31:23 -0000
@@ -26,7 +26,7 @@
#include "events.h"
#define GEN_EV(descr, event) { #event, NULL, descr, NULL, event }
-#define GEN_EV_TERMINATOR { NULL, NULL, NULL, NULL, -1 }
+#define GEN_EV_TERMINATOR { NULL, NULL, NULL, NULL, 0 }
/*
* Holds information about all event types. The entries don't have
@@ -246,12 +246,9 @@ void events_init(void)
event_to_index[i] = 0;
}
- for (i = 0;; i++) {
+ for (i = 0; events[i].enum_name; i++) {
int j;
- if (events[i].event < 0) {
- break;
- }
events[i].descr = _(events[i].descr_orig);
event_to_index[events[i].event] = i;
events[i].tag_name = mystrdup(events[i].enum_name);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13951) bug with E_NOEVENT patch,
Jason Short <=
|
|