Skip to content

Commit

Permalink
Optimize error paths in qvi_hwloc_bitmap_s. (#253)
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel K. Gutierrez <samuel@lanl.gov>
  • Loading branch information
samuelkgutierrez authored Jul 26, 2024
1 parent 6146b9f commit 46f6e1f
Showing 1 changed file with 6 additions and 6 deletions.
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

0 comments on commit 46f6e1f

Please sign in to comment.