-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
OESS-168: Remove clang warnings. #1299
Conversation
hyoklee
commented
Dec 15, 2021
udata->lnk->name = strdup(name); | ||
if (NULL == udata->lnk->name) { | ||
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "out of memory") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these changes are in callbacks, it sort of seems like doing a strdup each time probably wouldn't be optimal. This seems like the kind of thing that needs to be fixed somewhere higher up where we correctly differentiate between when the link name should be const and non-const.
If we do go with this change though, the strdup calls should be changed to HDstrdup, or even better, HDstrndup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HDstrndup() is not available in H5private.h.
strndup() is not available for MS VS C compiler.
Thus, I replaced strdup() with HDstrdup().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these changes are in callbacks, it sort of seems like doing a strdup each time probably wouldn't be optimal. This seems like the kind of thing that needs to be fixed somewhere higher up where we correctly differentiate between when the link name should be const and non-const.
Agree
The strdup is probably too much overhead for simply squashing a warning. |