Skip to content

Commit d42eb27

Browse files
Incorporate minor cleanups. (#81)
Signed-off-by: Samuel K. Gutierrez <[email protected]>
1 parent 6fe588b commit d42eb27

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/quo-vadis.cc

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ qv_bind_string(
7171
return QV_ERR_INVLD_ARG;
7272
}
7373

74+
*str = nullptr;
75+
7476
hwloc_cpuset_t cpuset = nullptr;
7577
int rc = qvi_rmi_task_get_cpubind(
7678
ctx->rmi,

src/qvi-scope.cc

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2020-2023 Triad National Security, LLC
3+
* Copyright (c) 2020-2024 Triad National Security, LLC
44
* All rights reserved.
55
*
66
* Copyright (c) 2020-2021 Lawrence Livermore National Security, LLC
@@ -410,9 +410,7 @@ qvi_global_split_get_cpuset(
410410
hwloc_cpuset_t *result
411411
) {
412412
// This shouldn't happen.
413-
if (gsplit.hwpools.size() == 0) {
414-
abort();
415-
}
413+
assert(gsplit.hwpools.size() != 0);
416414

417415
int rc = qvi_hwloc_bitmap_calloc(result);
418416
if (rc != QV_SUCCESS) return rc;
@@ -460,7 +458,8 @@ scope_init(
460458
qvi_group_t *group,
461459
qvi_hwpool_t *hwpool
462460
) {
463-
if (!rmi || !hwpool || !scope) abort();
461+
assert(rmi && hwpool && scope);
462+
464463
scope->rmi = rmi;
465464
scope->group = group;
466465
scope->hwpool = hwpool;
@@ -471,15 +470,15 @@ hwloc_const_cpuset_t
471470
qvi_scope_cpuset_get(
472471
qv_scope_t *scope
473472
) {
474-
if (!scope) abort();
473+
assert(scope);
475474
return qvi_hwpool_cpuset_get(scope->hwpool);
476475
}
477476

478477
const qvi_hwpool_t *
479478
qvi_scope_hwpool_get(
480479
qv_scope_t *scope
481480
) {
482-
if (!scope) abort();
481+
assert(scope);
483482
return scope->hwpool;
484483
}
485484

@@ -488,7 +487,7 @@ qvi_scope_taskid(
488487
qv_scope_t *scope,
489488
int *taskid
490489
) {
491-
if (!scope) abort();
490+
assert(scope);
492491
*taskid = scope->group->id();
493492
return QV_SUCCESS;
494493
}
@@ -498,7 +497,7 @@ qvi_scope_ntasks(
498497
qv_scope_t *scope,
499498
int *ntasks
500499
) {
501-
if (!scope) abort();
500+
assert(scope);
502501
*ntasks = scope->group->size();
503502
return QV_SUCCESS;
504503
}
@@ -507,7 +506,7 @@ int
507506
qvi_scope_barrier(
508507
qv_scope_t *scope
509508
) {
510-
if (!scope) abort();
509+
assert(scope);
511510
return scope->group->barrier();
512511
}
513512

@@ -551,7 +550,7 @@ qvi_group_t *
551550
qvi_scope_group_get(
552551
qv_scope_t *scope
553552
) {
554-
if (!scope) abort();
553+
assert(scope);
555554
return scope->group;
556555
}
557556

0 commit comments

Comments
 (0)