[chocolate-doom] 01/26: Catch calls to DEH_String before DEH_Init is called

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:07:37 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.1.4
in repository chocolate-doom.

commit 027efb6493ebc5ac9eda797442322ca217332a13
Author: Simon Howard <fraggle at gmail.com>
Date:   Sun Jan 22 21:17:22 2006 +0000

    Catch calls to DEH_String before DEH_Init is called
    
    Subversion-branch: /branches/CHOCOLATE_DOOM_0_1/chocolate-doom
    Subversion-revision: 313
---
 src/deh_text.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/deh_text.c b/src/deh_text.c
index 6d95944..58ae1ee 100644
--- a/src/deh_text.c
+++ b/src/deh_text.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: deh_text.c 175 2005-10-08 20:54:16Z fraggle $
+// $Id: deh_text.c 313 2006-01-22 21:17:22Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4.2.1  2006/01/22 21:17:22  fraggle
+// Catch calls to DEH_String before DEH_Init is called
+//
 // Revision 1.4  2005/10/08 20:54:16  fraggle
 // Proper dehacked error/warning framework.  Catch a load more errors.
 //
@@ -57,7 +60,7 @@ typedef struct
 
 static deh_substitution_t **hash_table;
 static int hash_table_entries;
-static int hash_table_length;
+static int hash_table_length = -1;
 
 // This is the algorithm used by glib
 
@@ -82,6 +85,11 @@ char *DEH_String(char *s)
 {
     int entry;
 
+    // Fallback if we have not initialised the hash table yet
+
+    if (hash_table_length < 0)
+	return s;
+
     entry = strhash(s) % hash_table_length;
 
     while (hash_table[entry] != NULL)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list