diff options
| author | krasimir <krasimir@chalmers.se> | 2017-05-04 08:21:29 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2017-05-04 08:21:29 +0000 |
| commit | a05194a350b12f49f41c8a9d7971a55fa0f78e60 (patch) | |
| tree | 08175288842457c3956d3cbf134f65e5a674a6f9 /src | |
| parent | 73e9eb934a3f6d74b4acfea3aa474650b3bd2c91 (diff) | |
remove duplicate entries from the lookup index
Diffstat (limited to 'src')
| -rw-r--r-- | src/runtime/c/pgf/lookup.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/runtime/c/pgf/lookup.c b/src/runtime/c/pgf/lookup.c index ac1e14a0d..5f2b3aff3 100644 --- a/src/runtime/c/pgf/lookup.c +++ b/src/runtime/c/pgf/lookup.c @@ -76,7 +76,17 @@ pgf_lookup_index_syms(GuMap* lexicon_idx, PgfSymbols* syms, PgfProductionIdx* id for (size_t k = 0; k < n_idx; k++) { PgfProductionIdxEntry* entry = gu_buf_index(idx, PgfProductionIdxEntry, k); - gu_buf_push(funs, PgfAbsFun*, entry->papp->fun->absfun); + bool found = false; + size_t n_funs = gu_buf_length(funs); + for (size_t l = 0; l < n_funs; l++) { + PgfAbsFun* fun = gu_buf_get(funs, PgfAbsFun*, l); + if (fun == entry->papp->fun->absfun) { + found = true; + break; + } + } + if (!found) + gu_buf_push(funs, PgfAbsFun*, entry->papp->fun->absfun); } break; } |
