From 942d35f72bea5a0d19a5d0e0a5ca533e37a88b2c Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Thu, 6 Jun 2019 14:10:08 +0100 Subject: libctf: avoid strndup Not all platforms have it. Use libiberty xstrndup() instead. (The include of libiberty.h happens in an unusual place due to the requirements of synchronization of most source files between this project and another that does not use libiberty. It serves to pull libiberty.h in for all source files in libctf/, which does the trick.) Tested on x86_64-pc-linux-gnu, x86_64-unknown-freebsd12.0, sparc-sun-solaris2.11, i686-pc-cygwin, i686-w64-mingw32. libctf/ * ctf-decls.h: Include . * ctf-lookup.c (ctf_lookup_by_name): Call xstrndup(), not strndup(). --- libctf/ctf-decls.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libctf/ctf-decls.h') diff --git a/libctf/ctf-decls.h b/libctf/ctf-decls.h index c840b79..b60a48f 100644 --- a/libctf/ctf-decls.h +++ b/libctf/ctf-decls.h @@ -24,6 +24,7 @@ #include #include +#include "libiberty.h" #if HAVE_QSORT_R_ARG_LAST static inline void -- cgit v1.1