Moved some simple things into mojoshader_common.c.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 03 Jan 2015 00:50:43 -0500
changeset 1146 31337471b909
parent 1145 07f69ab909ec
child 1147 ff14a55da268
Moved some simple things into mojoshader_common.c. This lets you build without mojoshader.c at all, if you're doing just the compiler, etc, and don't need all the bytecode parsing.
mojoshader.c
mojoshader_common.c
--- a/mojoshader.c	Wed Dec 31 16:49:59 2014 -0500
+++ b/mojoshader.c	Sat Jan 03 00:50:43 2015 -0500
@@ -270,22 +270,6 @@
 } Profile;
 
 
-// Convenience functions for allocators...
-#if !MOJOSHADER_FORCE_ALLOCATOR
-void *MOJOSHADER_internal_malloc(int bytes, void *d) { return malloc(bytes); }
-void MOJOSHADER_internal_free(void *ptr, void *d) { free(ptr); }
-#endif
-
-MOJOSHADER_error MOJOSHADER_out_of_mem_error = {
-    "Out of memory", NULL, MOJOSHADER_POSITION_NONE
-};
-
-MOJOSHADER_parseData MOJOSHADER_out_of_mem_data = {
-    1, &MOJOSHADER_out_of_mem_error, 0, 0, 0, 0,
-    MOJOSHADER_TYPE_UNKNOWN, 0, 0, 0, 0
-};
-
-
 // !!! FIXME: cut and paste between every damned source file follows...
 // !!! FIXME: We need to make some sort of ContextBase that applies to all
 // !!! FIXME:  files and move this stuff to mojoshader_common.c ...
--- a/mojoshader_common.c	Wed Dec 31 16:49:59 2014 -0500
+++ b/mojoshader_common.c	Sat Jan 03 00:50:43 2015 -0500
@@ -1,6 +1,22 @@
 #define __MOJOSHADER_INTERNAL__ 1
 #include "mojoshader_internal.h"
 
+// Convenience functions for allocators...
+#if !MOJOSHADER_FORCE_ALLOCATOR
+void *MOJOSHADER_internal_malloc(int bytes, void *d) { return malloc(bytes); }
+void MOJOSHADER_internal_free(void *ptr, void *d) { free(ptr); }
+#endif
+
+MOJOSHADER_error MOJOSHADER_out_of_mem_error = {
+    "Out of memory", NULL, MOJOSHADER_POSITION_NONE
+};
+
+MOJOSHADER_parseData MOJOSHADER_out_of_mem_data = {
+    1, &MOJOSHADER_out_of_mem_error, 0, 0, 0, 0,
+    MOJOSHADER_TYPE_UNKNOWN, 0, 0, 0, 0
+};
+
+
 typedef struct HashItem
 {
     const void *key;