Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Mar 2017 21:45:42 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315745 - head/contrib/libcxxrt
Message-ID:  <201703222145.v2MLjgYG032037@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Mar 22 21:45:42 2017
New Revision: 315745
URL: https://svnweb.freebsd.org/changeset/base/315745

Log:
  Cherry-pick libcxxrt commit 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92:
  
  Author: David Chisnall <theraven@FreeBSD.org>
  Date:   Wed Mar 22 12:27:08 2017 +0000
  
      Simplify some code.
  
      realloc() with a null pointer is equivalent to malloc, so we don't need
      to handle the two cases independently.
  
      Fixes #46
  
  This should help with lang/beignet and other programs, which expect
  __cxa_demangle(name, NULL, NULL, &status) to return zero in status.
  
  PR:		213732
  MFC after:	3 days

Modified:
  head/contrib/libcxxrt/typeinfo.cc

Modified: head/contrib/libcxxrt/typeinfo.cc
==============================================================================
--- head/contrib/libcxxrt/typeinfo.cc	Wed Mar 22 21:39:00 2017	(r315744)
+++ head/contrib/libcxxrt/typeinfo.cc	Wed Mar 22 21:45:42 2017	(r315745)
@@ -86,15 +86,7 @@ extern "C" char* __cxa_demangle(const ch
 	if (NULL != demangled)
 	{
 		size_t len = strlen(demangled);
-		if (buf == NULL)
-		{
-			if (n)
-			{
-				*n = len;
-			}
-			return demangled;
-		}
-		if (*n < len+1)
+		if (!buf || (*n < len+1))
 		{
 			buf = static_cast<char*>(realloc(buf, len+1));
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703222145.v2MLjgYG032037>