[Freeciv-Dev] serious gcc warning in svn trunk
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Commit 11782 by Jason has broken svn, at least for me.
The gcc warning (which seems important):
cc1: warnings being treated as errors
nation.c: In function âadd_new_nation_groupâ:
nation.c:354: warning: âgroupâ is used uninitialized in this function
make[4]: *** [nation.o] Error 1
make[4]: Leaving directory `/home/dev/freeciv/common'
The problem lies in common/nation.c, and here is a svn blame of the
problem area:
5354 rfalke
/***************************************************************
11782 jdorje Add new group into the array of groups.
10117 matusik
***************************************************************/
11782 jdorje struct nation_group *add_new_nation_group(const char *name)
10117 matusik {
10117 matusik int i;
11782 jdorje struct nation_group *group;
11782 jdorje
11782 jdorje if (strlen(name) >= ARRAY_SIZE(group->name)) {
11782 jdorje freelog(LOG_FATAL, "Too-long group name %s.",
group->name);
11782 jdorje exit(EXIT_FAILURE);
11782 jdorje }
11782 jdorje
and a diff between 11782 and the previous version:
/***************************************************************
- Add new group into the array of groups. If a group with
- the same name already exists don't create new one, but return
- old one
+ Add new group into the array of groups.
***************************************************************/
-struct nation_group* add_new_nation_group(const char* name)
+struct nation_group *add_new_nation_group(const char *name)
{
int i;
+ struct nation_group *group;
+
+ if (strlen(name) >= ARRAY_SIZE(group->name)) {
+ freelog(LOG_FATAL, "Too-long group name %s.", group->name);
+ exit(EXIT_FAILURE);
+ }
+
for (i = 0; i < num_nation_groups; i++) {
I am not sure what is the intended behaviour here.
- Per
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] serious gcc warning in svn trunk,
Per Inge Mathisen <=
|
|