Simplify StrDup().
authorRyan C. Gordon <icculus@icculus.org>
Sat, 07 Feb 2009 00:54:27 -0500
changeset 554 42dd28107cd8
parent 553 288ed486e5c3
child 555 940821555fda
Simplify StrDup().
mojoshader.c
mojoshader_assembler.c
--- a/mojoshader.c	Sat Feb 07 00:35:17 2009 -0500
+++ b/mojoshader.c	Sat Feb 07 00:54:27 2009 -0500
@@ -262,9 +262,7 @@
 static inline char *StrDup(Context *ctx, const char *str)
 {
     char *retval = (char *) Malloc(ctx, strlen(str) + 1);
-    if (retval == NULL)
-        out_of_memory(ctx);
-    else
+    if (retval != NULL)
         strcpy(retval, str);
     return retval;
 } // StrDup
--- a/mojoshader_assembler.c	Sat Feb 07 00:35:17 2009 -0500
+++ b/mojoshader_assembler.c	Sat Feb 07 00:54:27 2009 -0500
@@ -80,9 +80,7 @@
 static inline char *StrDup(Context *ctx, const char *str)
 {
     char *retval = (char *) Malloc(ctx, strlen(str) + 1);
-    if (retval == NULL)
-        out_of_memory(ctx);
-    else
+    if (retval != NULL)
         strcpy(retval, str);
     return retval;
 } // StrDup