Commit 244e2d9c by Ian Lance Taylor Committed by Ian Lance Taylor

dwarf.c: If the system header files do not declare strnlen, provide our own version.

	* dwarf.c: If the system header files do not declare strnlen,
	provide our own version.

From-SVN: r192082
parent 678771ad
2012-10-04 Ian Lance Taylor <iant@google.com>
* dwarf.c: If the system header files do not declare strnlen,
provide our own version.
2012-10-03 Ian Lance Taylor <iant@google.com>
* dwarf.c (read_uleb128): Fix overflow test.
......
......@@ -44,8 +44,22 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "internal.h"
#if !defined(HAVE_DECL_STRNLEN) || !HAVE_DECL_STRNLEN
/* The function is defined in libiberty if needed. */
extern size_t strnlen (const char *, size_t);
/* If strnlen is not declared, provide our own version. */
static size_t
xstrnlen (const char *s, size_t maxlen)
{
size_t i;
for (i = 0; i < maxlen; ++i)
if (s[i] == '\0')
break;
return i;
}
#define strnlen xstrnlen
#endif
/* A buffer to read DWARF info. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment