Port: Add compat for strnlen and strndup
[babeltrace.git] / formats / ctf / types / string.c
index c6935162d6c823b31315300a454bdf9109862739..a9cff6de28ceb3fe1a33f51c38d1d7546292c599 100644 (file)
@@ -29,7 +29,7 @@
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/ctf/types.h>
 #include <babeltrace/compat/limits.h>  /* C99 limits */
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/ctf/types.h>
 #include <babeltrace/compat/limits.h>  /* C99 limits */
-#include <string.h>
+#include <babeltrace/compat/string.h>
 
 int ctf_string_read(struct bt_stream_pos *ppos, struct bt_definition *definition)
 {
 
 int ctf_string_read(struct bt_stream_pos *ppos, struct bt_definition *definition)
 {
@@ -53,7 +53,7 @@ int ctf_string_read(struct bt_stream_pos *ppos, struct bt_definition *definition
        if (max_len_bits < 0)
                return -EFAULT;
        /* Add \0, counting in bytes. */
        if (max_len_bits < 0)
                return -EFAULT;
        /* Add \0, counting in bytes. */
-       len = strnlen(srcaddr, (size_t) max_len_bits / CHAR_BIT) + 1;
+       len = bt_strnlen(srcaddr, (size_t) max_len_bits / CHAR_BIT) + 1;
        /* Truncated string, unexpected. Trace probably corrupted. */
        if (srcaddr[len - 1] != '\0')
                return -EFAULT;
        /* Truncated string, unexpected. Trace probably corrupted. */
        if (srcaddr[len - 1] != '\0')
                return -EFAULT;
This page took 0.023731 seconds and 4 git commands to generate.