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

Optimize error paths in qvi_hwloc_bitmap_s. #253

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/qvi-hwloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,23 +428,23 @@ struct qvi_hwloc_bitmap_s {
qvi_hwloc_bitmap_s(void)
{
const int rc = qvi_hwloc_bitmap_calloc(&m_data);
if (rc != QV_SUCCESS) throw qvi_runtime_error();
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
}
/** Construct via hwloc_const_bitmap_t. */
explicit qvi_hwloc_bitmap_s(hwloc_const_bitmap_t bitmap)
{
int rc = qvi_hwloc_bitmap_calloc(&m_data);
if (rc != QV_SUCCESS) throw qvi_runtime_error();
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
rc = set(bitmap);
if (rc != QV_SUCCESS) throw qvi_runtime_error();
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
}
/** Copy constructor. */
qvi_hwloc_bitmap_s(const qvi_hwloc_bitmap_s &src)
{
int rc = qvi_hwloc_bitmap_calloc(&m_data);
if (rc != QV_SUCCESS) throw qvi_runtime_error();
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
rc = set(src.m_data);
if (rc != QV_SUCCESS) throw qvi_runtime_error();
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
}
/** Destructor. */
~qvi_hwloc_bitmap_s(void)
Expand All @@ -463,7 +463,7 @@ struct qvi_hwloc_bitmap_s {
operator=(const qvi_hwloc_bitmap_s &src)
{
const int rc = qvi_hwloc_bitmap_copy(src.m_data, m_data);
if (rc != QV_SUCCESS) throw qvi_runtime_error();
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
}
/** Sets the object's internal bitmap to match src's. */
int
Expand Down
Loading