diff options
author | Michal Krol <[email protected]> | 2009-09-07 17:45:26 +0200 |
---|---|---|
committer | Michal Krol <[email protected]> | 2009-09-07 17:45:26 +0200 |
commit | b97a73465816652dda36b08c19038f06964ff130 (patch) | |
tree | ea2c66eee6de07bc1e63ad22026b63d717129d13 /src/mesa/shader/grammar | |
parent | 8bed21ecf9ff3f0244de2011f5177f16136e255f (diff) |
grammar: Remove dead code.
Diffstat (limited to 'src/mesa/shader/grammar')
-rw-r--r-- | src/mesa/shader/grammar/grammar.c | 88 |
1 files changed, 25 insertions, 63 deletions
diff --git a/src/mesa/shader/grammar/grammar.c b/src/mesa/shader/grammar/grammar.c index f1e3b837c44..999cd3f3a53 100644 --- a/src/mesa/shader/grammar/grammar.c +++ b/src/mesa/shader/grammar/grammar.c @@ -3013,14 +3013,18 @@ int grammar_set_reg8 (grammar id, const byte *name, byte value) return 1; } -/* - internal checking function used by both grammar_check and grammar_fast_check functions -*/ -static int _grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size, - unsigned int estimate_prod_size, int use_fast_path) -{ - dict *di = NULL; +int +grammar_fast_check (grammar id, + const byte *text, + byte **prod, + unsigned int *size, + unsigned int estimate_prod_size) +{ + dict *di = NULL; int index = 0; + regbyte_ctx *rbc = NULL; + bytepool *bp = NULL; + int _P = 0; clear_last_error (); @@ -3034,69 +3038,27 @@ static int _grammar_check (grammar id, const byte *text, byte **prod, unsigned i *prod = NULL; *size = 0; - if (use_fast_path) - { - regbyte_ctx *rbc = NULL; - bytepool *bp = NULL; - int _P = 0; - - bytepool_create (&bp, estimate_prod_size); - if (bp == NULL) - return 0; - - if (fast_match (di, text, &index, di->m_syntax, &_P, bp, 0, &rbc) != mr_matched) - { - bytepool_destroy (&bp); - free_regbyte_ctx_stack (rbc, NULL); - return 0; - } - - free_regbyte_ctx_stack (rbc, NULL); - - *prod = bp->_F; - *size = _P; - bp->_F = NULL; - bytepool_destroy (&bp); - } - else - { - regbyte_ctx *rbc = NULL; - barray *ba = NULL; - - barray_create (&ba); - if (ba == NULL) - return 0; - - if (match (di, text, &index, di->m_syntax, &ba, 0, &rbc) != mr_matched) - { - barray_destroy (&ba); - free_regbyte_ctx_stack (rbc, NULL); - return 0; - } + bytepool_create (&bp, estimate_prod_size); + if (bp == NULL) + return 0; - free_regbyte_ctx_stack (rbc, NULL); + if (fast_match (di, text, &index, di->m_syntax, &_P, bp, 0, &rbc) != mr_matched) + { + bytepool_destroy (&bp); + free_regbyte_ctx_stack (rbc, NULL); + return 0; + } - *prod = (byte *) mem_alloc (ba->len * sizeof (byte)); - if (*prod == NULL) - { - barray_destroy (&ba); - return 0; - } + free_regbyte_ctx_stack (rbc, NULL); - mem_copy (*prod, ba->data, ba->len * sizeof (byte)); - *size = ba->len; - barray_destroy (&ba); - } + *prod = bp->_F; + *size = _P; + bp->_F = NULL; + bytepool_destroy (&bp); return 1; } -int grammar_fast_check (grammar id, const byte *text, byte **prod, unsigned int *size, - unsigned int estimate_prod_size) -{ - return _grammar_check (id, text, prod, size, estimate_prod_size, 1); -} - int grammar_destroy (grammar id) { dict **di = &g_dicts; |