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

Incorporate trivial utility cleanups. #310

Merged
merged 1 commit into from
Feb 20, 2025
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
14 changes: 7 additions & 7 deletions src/qvi-utils.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2020-2024 Triad National Security, LLC
* Copyright (c) 2020-2025 Triad National Security, LLC
* All rights reserved.
*
* Copyright (c) 2020-2021 Lawrence Livermore National Security, LLC
Expand Down Expand Up @@ -105,15 +105,15 @@ qvi_atoi(
const long val = strtol(str, &end, 10);
int err = errno;
// Did we get any digits?
if (str == end) return QV_ERR_INVLD_ARG;
if (qvi_unlikely(str == end)) return QV_ERR_INVLD_ARG;
// In valid range?
if (val > INT_MAX || (err == ERANGE && val == LONG_MAX)) {
if (qvi_unlikely(val > INT_MAX || (err == ERANGE && val == LONG_MAX))) {
return QV_ERR_INVLD_ARG;
}
if (val < INT_MIN || (err == ERANGE && val == LONG_MIN)) {
if (qvi_unlikely(val < INT_MIN || (err == ERANGE && val == LONG_MIN))) {
return QV_ERR_INVLD_ARG;
}
if (*end != '\0') return QV_ERR_INVLD_ARG;
if (qvi_unlikely(*end != '\0')) return QV_ERR_INVLD_ARG;

*maybe_val = (int)val;
return QV_SUCCESS;
Expand All @@ -132,13 +132,13 @@ int
qvi_url(
std::string &url
) {
static const cstr_t base = "tcp://127.0.0.1";
static const std::string base = "tcp://127.0.0.1";

int port = 0;
const int rc = qvi_port(&port);
if (rc != QV_SUCCESS) return rc;

url = std::string(base) + ":" + std::to_string(port);
url = base + ":" + std::to_string(port);
return rc;
}

Expand Down