common: fix compilation when strnlen, strnup and memrchr are not available
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Nov 2021 02:29:16 +0000 (21:29 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 17 Nov 2021 18:28:50 +0000 (13:28 -0500)
commite59345cc9499a4ca7e5bb66579e50af7dc841425
treeab60ea42a3671b28ab65b33ec083254a3ac9059b
parent3c4c35827bdf49a2e148829672e6ff1a9c1b1bb8
common: fix compilation when strnlen, strnup and memrchr are not available

Add a few casts to fix build failure when these functions are not
available.  For example:

      CXX      lttng-conf.o
In file included from /home/smarchi/src/lttng-tools/src/common/macros.h:15:0,
                 from /home/smarchi/src/lttng-tools/src/common/error.h:19,
                 from /home/smarchi/src/lttng-tools/src/common/common.h:12,
                 from /home/smarchi/src/lttng-tools/src/bin/lttng/conf.cpp:18:
/home/smarchi/src/lttng-tools/src/common/compat/string.h: In function ‘size_t lttng_strnlen(const char*, size_t)’:
/home/smarchi/src/lttng-tools/src/common/compat/string.h:28:14: error: invalid conversion from ‘const void*’ to ‘const char*’ [-fpermissive]
  end = memchr(str, 0, max);
        ~~~~~~^~~~~~~~~~~~~

This can be tested by modifying config.cache and setting the relevant
config variables to "no".

Change-Id: Ieb6debf32c82927767ad32d2f4aa62fb829a9f9f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/compat/string.h
This page took 0.031089 seconds and 4 git commands to generate.