Clean-up: use const reference where possible
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 13 Apr 2023 18:41:43 +0000 (14:41 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 18 Apr 2023 14:37:07 +0000 (10:37 -0400)
These exceptions can all be caught by const reference.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I11a4f5018c838d77212340efa6f94d5d1c005ed6

src/bin/lttng-sessiond/cmd.cpp
src/bin/lttng-sessiond/ust-app.cpp
src/common/random.cpp
src/common/uuid.cpp

index e89bcd15ebb49fad7d5c0348df4f4ee6188a5722..79cb6fed89398e00833f2ea27620090eba09e81e 100644 (file)
@@ -3435,7 +3435,7 @@ int cmd_destroy_session(struct ltt_session *session, int *sock_fd)
                try {
                        the_rotation_thread_handle->unsubscribe_session_consumed_size_rotation(
                                *session);
-               } catch (std::exception& e) {
+               } catch (const std::exception& e) {
                        /* Continue the destruction of the session anyway. */
                        ERR("Failed to unsubscribe rotation thread notification channel from consumed size condition during session destruction: %s",
                            e.what());
@@ -5898,7 +5898,7 @@ int cmd_rotation_set_schedule(struct ltt_session *session,
                        try {
                                the_rotation_thread_handle->subscribe_session_consumed_size_rotation(
                                        *session, new_value);
-                       } catch (std::exception& e) {
+                       } catch (const std::exception& e) {
                                ERR("Failed to enable consumed-size notification in ROTATION_SET_SCHEDULE command: %s",
                                    e.what());
                                ret = LTTNG_ERR_UNK;
@@ -5908,7 +5908,7 @@ int cmd_rotation_set_schedule(struct ltt_session *session,
                        try {
                                the_rotation_thread_handle
                                        ->unsubscribe_session_consumed_size_rotation(*session);
-                       } catch (std::exception& e) {
+                       } catch (const std::exception& e) {
                                ERR("Failed to disable consumed-size notification in ROTATION_SET_SCHEDULE command: %s",
                                    e.what());
                                ret = LTTNG_ERR_UNK;
index bdc7d6d2065b66eba162f58e620166b706bc5668..b9091424bb274b6b80a837ee519b7bf0e8dd6689 100644 (file)
@@ -6612,7 +6612,7 @@ static int handle_app_register_channel_notification(int sock,
                                goto reply;
                        }
                }
-       } catch (std::exception& ex) {
+       } catch (const std::exception& ex) {
                ERR("Failed to handle application context: %s", ex.what());
                ret_code = -EINVAL;
                goto reply;
index 5a038a563e12b339a25f307cf4e83cc12c6d1bfc..ec74688ec976df098f60ea330b3a7ae4eb4903e2 100644 (file)
@@ -170,7 +170,7 @@ lttng::random::seed_t lttng::random::produce_best_effort_random_seed()
 {
        try {
                return lttng::random::produce_true_random_seed();
-       } catch (std::exception& e) {
+       } catch (const std::exception& e) {
                WARN("%s",
                     fmt::format(
                             "Failed to produce a random seed using getrandom(), falling back to pseudo-random device seed generation which will block until its pool is initialized: {}",
@@ -184,7 +184,7 @@ lttng::random::seed_t lttng::random::produce_best_effort_random_seed()
                 * under some containerized environments.
                 */
                produce_random_seed_from_urandom();
-       } catch (std::exception& e) {
+       } catch (const std::exception& e) {
                WARN("%s",
                     fmt::format("Failed to produce a random seed from the urandom device: {}",
                                 e.what())
index ddf0fb509c9fe45fab7067820b1032e657c4e3a3..8aa42a4e6fc4b579d55f84d4bcceca43f70a4ef0 100644 (file)
@@ -83,7 +83,7 @@ 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) {
+               } catch (const std::exception& e) {
                        ERR("Failed to initialize random seed during generation of UUID: %s",
                            e.what());
                        ret = -1;
This page took 0.030596 seconds and 4 git commands to generate.