]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Enable better malloc/free checking in a few cases.
authorBruno Haible <bruno@clisp.org>
Sat, 3 Jun 2023 11:27:03 +0000 (13:27 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Jun 2023 13:54:10 +0000 (15:54 +0200)
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'.

gettext-tools/src/po-time.h
gettext-tools/src/write-po.h

index a01484665c12b6b1fb18cf4700ea85e01be6b74e..cf7dc63f9bf7bf7dfc7f18fa344051944e09666c 100644 (file)
@@ -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 <haible@clisp.cons.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
@@ -20,6 +20,8 @@
 
 #include <time.h>
 
+#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
index 6d32e6578cf41f6662e1795bdf87e094351ebdc3..47dd7b19057c19d0500e1a413c9068c13071a5d6 100644 (file)
@@ -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 <millerp@canb.auug.org.au>
 
@@ -24,6 +23,7 @@
 
 #include <textstyle.h>
 
+#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