From: Bruno Haible Date: Sat, 3 Jun 2023 11:27:03 +0000 (+0200) Subject: Enable better malloc/free checking in a few cases. X-Git-Tag: v0.22~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0a309dfb1b0b0b1c81cca8279852901f8be68fb;p=thirdparty%2Fgettext.git Enable better malloc/free checking in a few cases. Pinpointed by gcc 13 warning: warning: function might be candidate for attribute 'malloc' [-Wsuggest-attribute=malloc] * gettext-tools/src/po-time.h: Include attribute.h. (po_strftime): Mark with attribute 'malloc'. * gettext-tools/src/write-po.h: Include attribute.h. (make_range_description_string): Mark with attribute 'malloc'. --- diff --git a/gettext-tools/src/po-time.h b/gettext-tools/src/po-time.h index a01484665..cf7dc63f9 100644 --- a/gettext-tools/src/po-time.h +++ b/gettext-tools/src/po-time.h @@ -1,5 +1,5 @@ /* PO/POT file timestamps. - Copyright (C) 2001-2003 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2023 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify @@ -20,6 +20,8 @@ #include +#include "attribute.h" + #ifdef __cplusplus extern "C" { @@ -28,7 +30,8 @@ extern "C" { /* Return a freshly allocated string containing the given time in the format YYYY-MM-DD HH:MM+TZOFF. */ -extern char *po_strftime (const time_t *tp); +extern char *po_strftime (const time_t *tp) + ATTRIBUTE_MALLOC; #ifdef __cplusplus diff --git a/gettext-tools/src/write-po.h b/gettext-tools/src/write-po.h index 6d32e6578..47dd7b190 100644 --- a/gettext-tools/src/write-po.h +++ b/gettext-tools/src/write-po.h @@ -1,6 +1,5 @@ /* GNU gettext - internationalization aids - Copyright (C) 1995-1998, 2000-2003, 2006, 2008, 2014, 2018-2019, 2021 Free Software - Foundation, Inc. + Copyright (C) 1995-1998, 2000-2003, 2006, 2008, 2014, 2018-2019, 2021, 2023 Free Software Foundation, Inc. This file was written by Peter Miller @@ -24,6 +23,7 @@ #include +#include "attribute.h" #include "message.h" @@ -47,7 +47,8 @@ extern bool significant_format_p (enum is_format is_format); extern char * - make_range_description_string (struct argument_range range); + make_range_description_string (struct argument_range range) + ATTRIBUTE_MALLOC; /* These functions output parts of a message, as comments. */ extern void