Skip to content

Commit

Permalink
Fixes ion_catalog_find_symbol_table does not find anything. (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
m6w6 authored Dec 21, 2021
1 parent fef680b commit 9310a99
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ionc/ion_catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ iERR ion_catalog_find_symbol_table(hCATALOG hcatalog, iSTRING name, long version
iERR _ion_catalog_find_symbol_table_helper(ION_CATALOG *pcatalog, ION_STRING *name, int32_t version, ION_SYMBOL_TABLE **p_psymtab)
{
iENTER;
ION_SYMBOL_TABLE *symtab;
ION_SYMBOL_TABLE **ppsymtab, *psymtab, *found = NULL;
ION_COLLECTION_CURSOR symtab_cursor;

ASSERT(pcatalog != NULL);
Expand All @@ -195,20 +195,24 @@ iERR _ion_catalog_find_symbol_table_helper(ION_CATALOG *pcatalog, ION_STRING *na
if (version == pcatalog->system_symbol_table->version
&& ION_STRING_EQUALS(name, &pcatalog->system_symbol_table->name)
) {
symtab = pcatalog->system_symbol_table;
found = pcatalog->system_symbol_table;
}
else {
ION_COLLECTION_OPEN(&pcatalog->table_list, symtab_cursor);
for (;;) {
ION_COLLECTION_NEXT(symtab_cursor, symtab);
if (!symtab) break;
if (symtab->version != version) continue;
if (ION_STRING_EQUALS(name, &symtab->name)) break;
ION_COLLECTION_NEXT(symtab_cursor, ppsymtab);
if (!ppsymtab) break;
psymtab = *ppsymtab;
if (psymtab->version != version) continue;
if (ION_STRING_EQUALS(name, &psymtab->name)) {
found = psymtab;
break;
}
}
ION_COLLECTION_CLOSE(symtab_cursor);
}

*p_psymtab = symtab;
*p_psymtab = found;
SUCCEED();

iRETURN;
Expand Down

0 comments on commit 9310a99

Please sign in to comment.