From 8784a4d054e8bfe27af0581fc9441c64a52b1074 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 3 Sep 2021 17:31:29 -0400 Subject: [PATCH] common: compile libhealth as C++ MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Ie5362170a7b58850bbb00b30e130dfb0986a2dd3 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- src/common/health/Makefile.am | 2 +- src/common/health/{health.c => health.cpp} | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) rename src/common/health/{health.c => health.cpp} (96%) diff --git a/src/common/health/Makefile.am b/src/common/health/Makefile.am index 42490256a..cb10139f8 100644 --- a/src/common/health/Makefile.am +++ b/src/common/health/Makefile.am @@ -2,4 +2,4 @@ noinst_LTLIBRARIES = libhealth.la -libhealth_la_SOURCES = health.c +libhealth_la_SOURCES = health.cpp diff --git a/src/common/health/health.c b/src/common/health/health.cpp similarity index 96% rename from src/common/health/health.c rename to src/common/health/health.cpp index 8f147c678..8a07e6426 100644 --- a/src/common/health/health.c +++ b/src/common/health/health.cpp @@ -7,6 +7,7 @@ */ #define _LGPL_SOURCE +#include #include #include #include @@ -55,22 +56,22 @@ void health_init(struct health_app *ha) * Get the maximum value between the default delta value and the TCP * timeout with a safety net of the default health check delta. */ - ha->time_delta.tv_sec = max_t(unsigned long, + ha->time_delta.tv_sec = std::max( lttcomm_inet_tcp_timeout + DEFAULT_HEALTH_CHECK_DELTA_S, ha->time_delta.tv_sec); DBG("Health check time delta in seconds set to %lu", - ha->time_delta.tv_sec); + ha->time_delta.tv_sec); } struct health_app *health_app_create(int nr_types) { struct health_app *ha; - ha = zmalloc(sizeof(*ha)); + ha = (health_app *) zmalloc(sizeof(*ha)); if (!ha) { return NULL; } - ha->flags = zmalloc(sizeof(*ha->flags) * nr_types); + ha->flags = (health_flags *) zmalloc(sizeof(*ha->flags) * nr_types); if (!ha->flags) { goto error_flags; } @@ -266,7 +267,7 @@ void health_register(struct health_app *ha, int type) uatomic_set(&URCU_TLS(health_state).last_time.tv_sec, 0); uatomic_set(&URCU_TLS(health_state).last_time.tv_nsec, 0); uatomic_set(&URCU_TLS(health_state).current, 0); - uatomic_set(&URCU_TLS(health_state).flags, 0); + uatomic_set(&URCU_TLS(health_state).flags, (health_flags) 0); uatomic_set(&URCU_TLS(health_state).type, type); /* Add it to the global TLS state list. */ -- 2.34.1