Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type mismatch in use of atom index #1444

Open
UncleGrumpy opened this issue Dec 30, 2024 · 0 comments
Open

Type mismatch in use of atom index #1444

UncleGrumpy opened this issue Dec 30, 2024 · 0 comments

Comments

@UncleGrumpy
Copy link
Collaborator

There is a discrepancy with the return value of atom_table_ensure_atom which is a long, but globalcontext_insert_atom_maybe_copy which returns the result of atom_table_ensure_atom has a return value of int. This also extends to globalcontext_insert_atom which calls globalcontext_insert_atom_maybe_copy, and may have unintended consequences for globalcontext_make_atom as well.

globalcontest.h lines 360-368

static inline int globalcontext_insert_atom_maybe_copy(GlobalContext *glb, AtomString atom_string, int copy)
{
    long index = atom_table_ensure_atom(
        glb->atom_table, atom_string, copy ? AtomTableCopyAtom : AtomTableNoOpts);
    if (UNLIKELY(index) < 0) {
        return -1;
    }
    return index;
}

atom_table.c line 401

long atom_table_ensure_atom(struct AtomTable *table, AtomString string, enum AtomTableCopyOpt opts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant