Opened 6 years ago

Closed 6 years ago

#1757 closed bug (fixed (in master))

Patch received via email; fixes mon-init

Reported by: takkaria Owned by:
Milestone: 3.5.0 Keywords:
Cc:

Description

From "Scott Michael". This cleans up a few compiler warnings about uninitialized variables (and I think you had a typo in the code around the line "fb = r->friends_base"):

diff --git a/src/monster/mon-init.c b/src/monster/mon-init.c
index b95a87e..a7734a9 100644
--- a/src/monster/mon-init.c
+++ b/src/monster/mon-init.c
@@ -631,32 +631,32 @@ static void cleanup_r(void)

        for (ridx = 0; ridx < z_info->r_max; ridx++) {
                struct monster_race *r = &r_info[ridx];
-               struct monster_drop *d, *dn;
-               struct monster_friends *f, *fn;
-               struct monster_friends_base *fb, *fbn;
-               struct monster_mimic *m, *mn;
+               struct monster_drop *d = NULL;
+               struct monster_friends *f = NULL;
+               struct monster_friends_base *fb = NULL;
+               struct monster_mimic *m = NULL;

                d = r->drops;
                while (d) {
-                       dn = d->next;
+                       struct monster_drop *dn = d->next;
                        mem_free(d);
                        d = dn;
                }
                f = r->friends;
                while (f) {
-                       fn = f->next;
+                       struct monster_friends *fn = f->next;
                        mem_free(f);
                        f = fn;
                }
-               while (fb) {
                fb = r->friends_base;
-                       fbn = fb->next;
+               while (fb) {
+                       struct monster_friends_base *fbn = fb->next;
                        mem_free(fb);
                        fb = fbn;
                }
                m = r->mimic_kinds;
                while (m) {
-                       mn = m->next;
+                       struct monster_mimic *mn = m->next;
                        mem_free(m);
                        m = mn;
                }

Change History (1)

comment:1 Changed 6 years ago by takkaria

  • Resolution set to fixed (in master)
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.