summaryrefslogtreecommitdiff
path: root/HACKING
diff options
context:
space:
mode:
authorSimon Howard2014-10-24 20:29:56 -0400
committerSimon Howard2014-10-24 20:29:56 -0400
commit9d01d090c48c74a29b4ef67e0cd204772a2193c3 (patch)
tree3a8dce09c81c6cd9db8adf266d5cc6eae366af98 /HACKING
parentb42b5269e0ad5b22acd6043429ec4013a4e76ddd (diff)
downloadchocolate-doom-9d01d090c48c74a29b4ef67e0cd204772a2193c3.tar.gz
chocolate-doom-9d01d090c48c74a29b4ef67e0cd204772a2193c3.tar.bz2
chocolate-doom-9d01d090c48c74a29b4ef67e0cd204772a2193c3.zip
Replace strdup() with M_StringDuplicate().
strdup() can theoretically fail and return NULL. This could lead to a crash or undesirable behavior. Add M_StringDuplicate() which does the same thing but exits with an error if a string cannot be allocated. This fixes #456. Thanks to Quasar for the suggestion.
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING1
1 files changed, 1 insertions, 0 deletions
diff --git a/HACKING b/HACKING
index a7284ba5..3bbe23d0 100644
--- a/HACKING
+++ b/HACKING
@@ -130,6 +130,7 @@ avoided when writing code for Chocolate Doom. These are:
strncpy() M_StringCopy()
strcat() M_StringConcat()
strncat() M_StringConcat()
+ strdup() M_StringDuplicate()
Lots of the code includes calls to DEH_String() to simulate string
replacement by the Dehacked tool. Be careful when using Dehacked