Skip to content

Commit

Permalink
Moved some simple things into mojoshader_common.c.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
icculus committed Jan 3, 2015
1 parent 44bf450 commit 24884bb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 0 additions & 16 deletions mojoshader.c
Expand Up @@ -270,22 +270,6 @@ typedef struct Profile
} 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 ...
Expand Down
16 changes: 16 additions & 0 deletions mojoshader_common.c
@@ -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;
Expand Down

0 comments on commit 24884bb

Please sign in to comment.