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

Change naked constants into pre-processor defines #89

Closed
edwardhartnett opened this issue Oct 13, 2021 · 1 comment · Fixed by #86 or #90
Closed

Change naked constants into pre-processor defines #89

edwardhartnett opened this issue Oct 13, 2021 · 1 comment · Fixed by #86 or #90
Assignees
Labels
enhancement New feature or request

Comments

@edwardhartnett
Copy link
Contributor

In bacio.c we have code like this (note the use of bare constants in return statements):

    /* Check for illegal combinations of options */
    if ((BAOPEN_RONLY & *mode) &&
        ((BAOPEN_WONLY & *mode) || (BAOPEN_WONLY_TRUNC & *mode) || (BAOPEN_WONLY_APPEND & *mode)))
        return 255;

    if ((BAREAD & *mode) && (BAWRITE & *mode)) 
        return 254;

    /* Copy and null terminate the filename. */
    if ((BAOPEN_RONLY & *mode) || (BAOPEN_WONLY & *mode) ||
        (BAOPEN_WONLY_TRUNC & *mode) || (BAOPEN_WONLY_APPEND & *mode) ||
        (BAOPEN_RW & *mode))
    {
        if (!(realname = (char *) malloc((namelen + 1) * sizeof(char))))
            return 253;

Of course these should be pre-processor defines, like well-behaved C code...

@edwardhartnett
Copy link
Contributor Author

These changes got lost in a merge...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant