Skip to content

Commit 0d74f62

Browse files
maass-hamburgkartben
authored andcommitted
logging: backend: net: use sizeof to check Kconfig
Use sizeof to check if the Kconfig value had been set, to allow the compiler to optimize. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 211c0e3 commit 0d74f62

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

subsys/logging/backends/log_backend_net.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ static void init_net(struct log_backend const *const backend)
314314
{
315315
ARG_UNUSED(backend);
316316

317-
if (strlen(CONFIG_LOG_BACKEND_NET_SERVER) != 0) {
317+
if (sizeof(CONFIG_LOG_BACKEND_NET_SERVER) != 1) {
318+
/* Non empty address, set server via Kconfig defaults */
318319
const char *server = CONFIG_LOG_BACKEND_NET_SERVER;
319320
bool ret;
320321

0 commit comments

Comments
 (0)