summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/angband.h1
-rw-r--r--src/externs.h2
-rw-r--r--src/main-win.c6
-rw-r--r--src/main-x11.c24
-rw-r--r--src/z-form.h2
-rw-r--r--src/z-term.c14
-rw-r--r--src/z-virt.c22
-rw-r--r--src/z-virt.h24
9 files changed, 41 insertions, 56 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1885b2a0..bb49ff19 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,7 +7,7 @@ ADD_SUBDIRECTORY (squelch)
# Sources
SET(SRCS
main-gcu.c main-x11.c main-xaw.c main-sdl.c main-gtk2.c
- z-rand.c z-util.c z-form.c z-virt.c z-term.c
+ z-rand.c z-util.c z-form.c z-term.c
variable.cc tables.cc hooks.cc util.cc cave.cc dungeon.cc
melee1.cc melee2.cc messages.cc modules.cc
q_god.cc q_library.cc q_fireprof.cc q_bounty.cc q_thrain.cc
diff --git a/src/angband.h b/src/angband.h
index 7cceb7bd..12cdd822 100644
--- a/src/angband.h
+++ b/src/angband.h
@@ -32,7 +32,6 @@ extern "C" {
* Then, include the header files for the low-level code
*/
#include "z-util.h"
-#include "z-virt.h"
#include "z-form.h"
#include "z-rand.h"
#include "z-term.h"
diff --git a/src/externs.h b/src/externs.h
index ff1133b2..ef73fe82 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -4,7 +4,7 @@
/*
* Note that some files have their own header files
- * (z-virt.h, z-util.h, z-form.h, term.h, random.h)
+ * (z-util.h, z-form.h, term.h, random.h)
*/
/*
diff --git a/src/main-win.c b/src/main-win.c
index 9eafe314..368804be 100644
--- a/src/main-win.c
+++ b/src/main-win.c
@@ -954,7 +954,11 @@ static int new_palette(void)
pLogPalSize = sizeof(LOGPALETTE) + (nEntries + 16) * sizeof(PALETTEENTRY);
/* Allocate palette */
- pLogPal = (LPLOGPALETTE) safe_calloc(1, pLogPalSize);
+ pLogPal = (LPLOGPALETTE) calloc(1, pLogPalSize);
+ if (pLogPal == NULL)
+ {
+ abort();
+ }
/* Version */
pLogPal->palVersion = 0x300;
diff --git a/src/main-x11.c b/src/main-x11.c
index 43afa298..68697061 100644
--- a/src/main-x11.c
+++ b/src/main-x11.c
@@ -2303,7 +2303,11 @@ static errr term_data_init(term_data *td, int i)
/* Prepare the standard font */
- td->fnt = safe_calloc(1, sizeof(struct infofnt));
+ td->fnt = calloc(1, sizeof(struct infofnt));
+ if (td->fnt == NULL)
+ {
+ abort();
+ }
Infofnt_set(td->fnt);
Infofnt_init_data(font);
@@ -2315,7 +2319,11 @@ static errr term_data_init(term_data *td, int i)
hgt = rows * td->fnt->hgt + (oy + oy);
/* Create a top-window */
- td->win = safe_calloc(1, sizeof(struct infowin));
+ td->win = calloc(1, sizeof(struct infowin));
+ if (td->win == NULL)
+ {
+ abort();
+ }
Infowin_set(td->win);
Infowin_init_top(x, y, wid, hgt, 0,
Metadpy->fg, Metadpy->bg);
@@ -2461,7 +2469,11 @@ errr init_x11(int argc, char *argv[])
/* Prepare cursor color */
- xor = safe_calloc(1, sizeof(struct infoclr));
+ xor = calloc(1, sizeof(struct infoclr));
+ if (xor == NULL)
+ {
+ abort();
+ }
Infoclr_set(xor);
Infoclr_init_ppn(Metadpy->fg, Metadpy->bg, "xor", 0);
@@ -2471,7 +2483,11 @@ errr init_x11(int argc, char *argv[])
{
Pixell pixel;
- clr[i] = safe_calloc(1, sizeof(struct infoclr));
+ clr[i] = calloc(1, sizeof(struct infoclr));
+ if (clr[i] == NULL)
+ {
+ abort();
+ }
Infoclr_set(clr[i]);
/* Acquire Angband colors */
diff --git a/src/z-form.h b/src/z-form.h
index e1b6ce3b..61702432 100644
--- a/src/z-form.h
+++ b/src/z-form.h
@@ -14,7 +14,7 @@ extern "C" {
* See "z-form.c" for more detailed information about the routines,
* including a list of the legal "format sequences".
*
- * This file makes use of both "z-util.c" and "z-virt.c"
+ * This file makes use "z-util.c"
*/
diff --git a/src/z-term.c b/src/z-term.c
index cb429e17..7d1d5964 100644
--- a/src/z-term.c
+++ b/src/z-term.c
@@ -14,7 +14,6 @@
#include "z-term.h"
-#include "z-virt.h"
/*
@@ -245,6 +244,19 @@ term *Term = NULL;
/*
+ * Calloc wrapper which aborts if NULL is returned by calloc
+ */
+static void *safe_calloc(size_t nmemb, size_t size)
+{
+ void *p = calloc(nmemb, size);
+ if ((nmemb > 0) && (p == NULL))
+ {
+ abort();
+ }
+ return p;
+}
+
+/*
* Nuke a term_win (see below)
*/
static errr term_win_nuke(term_win *s, int w, int h)
diff --git a/src/z-virt.c b/src/z-virt.c
deleted file mode 100644
index e6b545e2..00000000
--- a/src/z-virt.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 1997 Ben Harrison
- *
- * This software may be copied and distributed for educational, research,
- * and not for profit purposes provided that this copyright and statement
- * are included in all such copies.
- */
-
-#include "z-virt.h"
-
-/*
- * Calloc wrapper which aborts if NULL is returned by calloc
- */
-extern void *safe_calloc(size_t nmemb, size_t size)
-{
- void *p = calloc(nmemb, size);
- if ((nmemb > 0) && (p == NULL))
- {
- abort();
- }
- return p;
-}
diff --git a/src/z-virt.h b/src/z-virt.h
deleted file mode 100644
index 52696518..00000000
--- a/src/z-virt.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 1997 Ben Harrison
- *
- * This software may be copied and distributed for educational, research,
- * and not for profit purposes provided that this copyright and statement
- * are included in all such copies.
- */
-
-#pragma once
-
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Calloc wrapper which aborts if NULL is returned by calloc
- */
-extern void *safe_calloc(size_t nmemb, size_t size);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif