From: Bruno Haible Date: Sat, 7 Aug 2021 21:15:21 +0000 (+0200) Subject: xstrndup: Improve GCC 11 allocation-deallocation checking. X-Git-Tag: v1.0~2684 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=d3c1eca926275d7138cdfd2eaebcf5de472fcdbf;p=gnulib.git xstrndup: Improve GCC 11 allocation-deallocation checking. * lib/xstrndup.h: Include instead of . (xstrndup): Declare that deallocation must happen through 'free'. --- diff --git a/ChangeLog b/ChangeLog index 7dccacbb46..8e3707f046 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-08-07 Bruno Haible + + xstrndup: Improve GCC 11 allocation-deallocation checking. + * lib/xstrndup.h: Include instead of . + (xstrndup): Declare that deallocation must happen through 'free'. + 2021-08-07 Bruno Haible xstriconveh: Improve GCC 11 allocation-deallocation checking. diff --git a/lib/xstrndup.h b/lib/xstrndup.h index 7fbbf2c1b9..dc4f6e273e 100644 --- a/lib/xstrndup.h +++ b/lib/xstrndup.h @@ -15,9 +15,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include +#include /* Return a newly allocated copy of at most N bytes of STRING. In other words, return a copy of the initial segment of length N of STRING. */ -extern char *xstrndup (const char *string, size_t n) _GL_ATTRIBUTE_MALLOC; +extern char *xstrndup (const char *string, size_t n) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_RETURNS_NONNULL;