From f94fff82fa23a34820850f54365fa4e12f8d686a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 18 Feb 2009 19:30:04 -0500 Subject: [PATCH] Changed DefineHash definition. --- mojoshader_preprocessor.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/mojoshader_preprocessor.c b/mojoshader_preprocessor.c index e6edd69b..80250ffd 100644 --- a/mojoshader_preprocessor.c +++ b/mojoshader_preprocessor.c @@ -29,7 +29,8 @@ static Token debug_preprocessor_lexer(IncludeState *s) typedef struct DefineHash { - MOJOSHADER_preprocessorDefine define; + const char *identifier; + const char *definition; struct DefineHash *next; } DefineHash; @@ -392,7 +393,7 @@ static int add_define(Context *ctx, const char *sym, const char *val, int copy) DefineHash *bucket = ctx->define_hashtable[hash]; while (bucket) { - if (strcmp(bucket->define.identifier, sym) == 0) + if (strcmp(bucket->identifier, sym) == 0) { failf(ctx, "'%s' already defined", sym); return 0; @@ -412,7 +413,7 @@ static int add_define(Context *ctx, const char *sym, const char *val, int copy) } // if if (!copy) - bucket->define.definition = val; + bucket->definition = val; else { definition = StrDup(ctx, val); @@ -422,10 +423,10 @@ static int add_define(Context *ctx, const char *sym, const char *val, int copy) put_define(ctx, bucket); return 0; } // if - bucket->define.definition = definition; + bucket->definition = definition; } // if - bucket->define.identifier = identifier; + bucket->identifier = identifier; bucket->next = ctx->define_hashtable[hash]; ctx->define_hashtable[hash] = bucket; return 1; @@ -439,14 +440,14 @@ static int remove_define(Context *ctx, const char *sym) DefineHash *prev = NULL; while (bucket) { - if (strcmp(bucket->define.identifier, sym) == 0) + if (strcmp(bucket->identifier, sym) == 0) { if (prev == NULL) ctx->define_hashtable[hash] = bucket->next; else prev->next = bucket->next; - Free(ctx, (void *) bucket->define.identifier); - Free(ctx, (void *) bucket->define.definition); + Free(ctx, (void *) bucket->identifier); + Free(ctx, (void *) bucket->definition); put_define(ctx, bucket); return 1; } // if @@ -464,8 +465,8 @@ static const char *find_define(Context *ctx, const char *sym) DefineHash *bucket = ctx->define_hashtable[hash]; while (bucket) { - if (strcmp(bucket->define.identifier, sym) == 0) - return bucket->define.definition; + if (strcmp(bucket->identifier, sym) == 0) + return bucket->definition; bucket = bucket->next; } // while return NULL; @@ -482,8 +483,8 @@ static void put_all_defines(Context *ctx) while (bucket) { DefineHash *next = bucket->next; - Free(ctx, (void *) bucket->define.identifier); - Free(ctx, (void *) bucket->define.definition); + Free(ctx, (void *) bucket->identifier); + Free(ctx, (void *) bucket->definition); put_define(ctx, bucket); bucket = next; } // while