summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2014-06-26 20:25:07 +0200
committerBardur Arantsson <bardur@scientician.net>2014-06-26 20:45:28 +0200
commit63e481780855d2d6469840d9ba853d91c6bb8c28 (patch)
treecc2058d41ea5fb6d6595d186183d7951b570e1ac /src
parent442d21a78026ec83de4495a78d8e36aa39fa95b6 (diff)
Replace usages of WIPE/C_WIPE with memset()
Diffstat (limited to 'src')
-rw-r--r--src/birth.cc3
-rw-r--r--src/cave.cc2
-rw-r--r--src/files.cc4
-rw-r--r--src/init2.cc8
-rw-r--r--src/main-win.c4
-rw-r--r--src/main-x11.c6
-rw-r--r--src/monster2.cc6
-rw-r--r--src/notes.cc2
-rw-r--r--src/object2.cc6
-rw-r--r--src/z-term.c2
10 files changed, 22 insertions, 21 deletions
diff --git a/src/birth.cc b/src/birth.cc
index 8612efdc..6f93d571 100644
--- a/src/birth.cc
+++ b/src/birth.cc
@@ -808,7 +808,8 @@ static void player_wipe(void)
wipe_saved();
/* Hack -- zero the struct */
- WIPE(p_ptr, player_type);
+ static_assert(std::is_pod<player_type>::value, "Cannot memset non-POD type");
+ memset(p_ptr, 0, sizeof(player_type));
/* Level 1 is the first level */
p_ptr->lev = 1;
diff --git a/src/cave.cc b/src/cave.cc
index bf75affe..e6b857cd 100644
--- a/src/cave.cc
+++ b/src/cave.cc
@@ -3234,7 +3234,7 @@ errr vinfo_init(void)
/* Make hack */
vinfo_hack hack;
- WIPE(&hack, vinfo_hack);
+ memset(&hack, 0, sizeof(vinfo_hack));
/* Analyze grids */
for (y = 0; y <= MAX_SIGHT; ++y)
diff --git a/src/files.cc b/src/files.cc
index ddfd5045..26687148 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -5152,7 +5152,7 @@ static errr top_twenty(void)
/* Clear the record */
- WIPE(&the_score, high_score);
+ memset(&the_score, 0, sizeof(high_score));
/* Save the version */
sprintf(the_score.what, "%ld.%ld.%ld",
@@ -5254,7 +5254,7 @@ errr predict_score(void)
}
/* Clear the record */
- WIPE(&the_score, high_score);
+ memset(&the_score, 0, sizeof(high_score));
/* Save the version */
sprintf(the_score.what, "%ld.%ld.%ld",
diff --git a/src/init2.cc b/src/init2.cc
index c8da918d..b809910e 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -1913,10 +1913,10 @@ static errr init_alloc(void)
/*** Analyze object allocation info ***/
/* Clear the "aux" array */
- C_WIPE(&aux, MAX_DEPTH_MONSTER, s16b);
+ memset(aux, 0, MAX_DEPTH_MONSTER * sizeof(s16b));
/* Clear the "num" array */
- C_WIPE(&num, MAX_DEPTH_MONSTER, s16b);
+ memset(num, 0, MAX_DEPTH_MONSTER * sizeof(s16b));
/* Size of "alloc_kind_table" */
alloc_kind_size = 0;
@@ -2002,10 +2002,10 @@ static errr init_alloc(void)
/*** Analyze monster allocation info ***/
/* Clear the "aux" array */
- C_WIPE(&aux, MAX_DEPTH_MONSTER, s16b);
+ memset(aux, 0, MAX_DEPTH_MONSTER * sizeof(s16b));
/* Clear the "num" array */
- C_WIPE(&num, MAX_DEPTH_MONSTER, s16b);
+ memset(num, 0, MAX_DEPTH_MONSTER * sizeof(s16b));
/* Size of "alloc_race_table" */
alloc_race_size = 0;
diff --git a/src/main-win.c b/src/main-win.c
index d9e2ff43..776c3e15 100644
--- a/src/main-win.c
+++ b/src/main-win.c
@@ -2223,7 +2223,7 @@ static void init_windows(void)
/* Main window */
td = &data[0];
- WIPE(td, term_data);
+ memset(td, 0, sizeof(term_data));
td->s = angband_term_name[0];
td->keys = 1024;
td->rows = 24;
@@ -2240,7 +2240,7 @@ static void init_windows(void)
for (i = 1; i < MAX_TERM_DATA; i++)
{
td = &data[i];
- WIPE(td, term_data);
+ memset(td, 0, sizeof(term_data));
td->s = angband_term_name[i];
td->keys = 16;
td->rows = 24;
diff --git a/src/main-x11.c b/src/main-x11.c
index bccb4d85..d15415f2 100644
--- a/src/main-x11.c
+++ b/src/main-x11.c
@@ -707,7 +707,7 @@ static errr Infowin_init_data(Window dad, int x, int y, int w, int h,
Window xid;
/* Wipe it clean */
- (void)WIPE(Infowin, infowin);
+ memset(Infowin, 0, sizeof(struct infowin));
/*** Error Check XXX ***/
@@ -942,7 +942,7 @@ static errr Infoclr_init_data(Pixell fg, Pixell bg, int op, int stip)
/*** Initialize ***/
/* Wipe the iclr clean */
- (void)WIPE(iclr, infoclr);
+ memset(iclr, 0, sizeof(struct infoclr));
/* Assign the GC */
iclr->gc = gc;
@@ -1046,7 +1046,7 @@ static errr Infofnt_init_data(cptr name)
/*** Init the font ***/
/* Wipe the thing */
- (void)WIPE(Infofnt, infofnt);
+ memset(Infofnt, 0, sizeof(struct infofnt));
/* Attempt to prepare it */
if (Infofnt_prepare(info))
diff --git a/src/monster2.cc b/src/monster2.cc
index 2f78f8b7..c91cacfd 100644
--- a/src/monster2.cc
+++ b/src/monster2.cc
@@ -495,7 +495,7 @@ void delete_monster_idx(int i)
}
/* Wipe the Monster */
- WIPE(m_ptr, monster_type);
+ memset(m_ptr, 0, sizeof(monster_type));
/* Count monsters */
m_cnt--;
@@ -613,7 +613,7 @@ static void compact_monsters_aux(int i1, int i2)
COPY(&m_list[i2], &m_list[i1], monster_type);
/* Wipe the hole */
- WIPE(&m_list[i1], monster_type);
+ memset(&m_list[i1], 0, sizeof(monster_type));
}
@@ -731,7 +731,7 @@ void wipe_m_list(void)
cave[m_ptr->fy][m_ptr->fx].m_idx = 0;
/* Wipe the Monster */
- WIPE(m_ptr, monster_type);
+ memset(m_ptr, 0, sizeof(monster_type));
}
/* Reset "m_max" */
diff --git a/src/notes.cc b/src/notes.cc
index 3504f61c..5d999fa3 100644
--- a/src/notes.cc
+++ b/src/notes.cc
@@ -89,7 +89,7 @@ void add_note(char *note, char code)
char depths[32];
/* Get the first 60 chars - so do not have an overflow */
- C_WIPE(buf, 100, char);
+ memset(buf, 0, sizeof(buf));
strncpy(buf, note, 60);
/* Get date and time */
diff --git a/src/object2.cc b/src/object2.cc
index 23d3d2b9..9f4d872e 100644
--- a/src/object2.cc
+++ b/src/object2.cc
@@ -534,7 +534,7 @@ void wipe_o_list(void)
}
/* Wipe the object */
- WIPE(o_ptr, object_type);
+ memset(o_ptr, 0, sizeof(object_type));
}
/* Reset "o_max" */
@@ -1898,7 +1898,7 @@ s16b lookup_kind(int tval, int sval)
void object_wipe(object_type *o_ptr)
{
/* Wipe the structure */
- WIPE(o_ptr, object_type);
+ memset(o_ptr, 0, sizeof(object_type));
}
@@ -1920,7 +1920,7 @@ void object_prep(object_type *o_ptr, int k_idx)
object_kind *k_ptr = &k_info[k_idx];
/* Clear the record */
- WIPE(o_ptr, object_type);
+ memset(o_ptr, 0, sizeof(object_type));
/* Save the kind index */
o_ptr->k_idx = k_idx;
diff --git a/src/z-term.c b/src/z-term.c
index be9190b6..fafd0b95 100644
--- a/src/z-term.c
+++ b/src/z-term.c
@@ -2611,7 +2611,7 @@ errr term_init(term *t, int w, int h, int k)
int y;
/* Wipe it */
- (void)WIPE(t, term);
+ memset(t, 0, sizeof(term));
/* Prepare the input queue */