X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fuuid.cpp;h=8aa42a4e6fc4b579d55f84d4bcceca43f70a4ef0;hb=4dfb0ef75c09bbf166e2bd6388e0e07c6af49b20;hp=bef038ac6f6675b915a9b3ee816b736918614190;hpb=57b90af7b1977684094706818e387433f50b7d48;p=lttng-tools.git diff --git a/src/common/uuid.cpp b/src/common/uuid.cpp index bef038ac6..8aa42a4e6 100644 --- a/src/common/uuid.cpp +++ b/src/common/uuid.cpp @@ -6,6 +6,8 @@ * */ +#include "uuid.hpp" + #include #include #include @@ -18,8 +20,6 @@ #include #include -#include "uuid.hpp" - namespace { const lttng_uuid nil_uuid = {}; bool lttng_uuid_is_init; @@ -45,7 +45,7 @@ std::string lttng::utils::uuid_to_str(const lttng_uuid& uuid) int lttng_uuid_from_str(const char *str_in, lttng_uuid& uuid_out) { int ret = 0; - lttng_uuid uuid_scan; + lttng_uuid uuid_scan = {}; if (str_in == nullptr) { ret = -1; @@ -58,8 +58,7 @@ int lttng_uuid_from_str(const char *str_in, lttng_uuid& uuid_out) } /* Scan to a temporary location in case of a partial match. */ - if (sscanf(str_in, LTTNG_UUID_FMT, LTTNG_UUID_SCAN_VALUES(uuid_scan)) != - LTTNG_UUID_LEN) { + if (sscanf(str_in, LTTNG_UUID_FMT, LTTNG_UUID_SCAN_VALUES(uuid_scan)) != LTTNG_UUID_LEN) { ret = -1; goto end; } @@ -84,11 +83,9 @@ int lttng_uuid_generate(lttng_uuid& uuid_out) if (!lttng_uuid_is_init) { try { srand(lttng::random::produce_best_effort_random_seed()); - } catch (std::exception& e) { - ERR("%s", - fmt::format("Failed to initialize random seed during generation of UUID: {}", - e.what()) - .c_str()); + } catch (const std::exception& e) { + ERR("Failed to initialize random seed during generation of UUID: %s", + e.what()); ret = -1; goto end; }