]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: add attributes to two functions without side effects
authorSamuel Tardieu <sam@rfc1149.net>
Fri, 5 Jan 2024 15:51:34 +0000 (16:51 +0100)
committerPádraig Brady <P@draigBrady.com>
Sat, 6 Jan 2024 15:42:44 +0000 (15:42 +0000)
* src/date.c (res_width): This function computes its result solely
from the value of its parameter and qualifies for the const attribute.
* src/tee.c (get_next_out): This function has no side effect and
qualifies for the pure attribute.
* THANKS.in: Remove duplicate now that author has a commit in the repo.

Those two functions were flagged by GCC 12.3.0,
though not by GCC 13.2.1.

THANKS.in
src/date.c
src/tee.c

index 83bee6a7ec899b8f5ffe351553eb94c5a2c53516..47144a5ceb8e190991c367dd6d659dad3f2439d3 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
@@ -566,7 +566,6 @@ Rudolf Kastl                        rkastl@redhat.com
 Sahil Amoli                         sahilamoli@gmail.com
 Sami Farin                          sfarin@ratol.fi
 Samuel Neves                        sneves@dei.uc.pt
-Samuel Tardieu                      sam@rfc1149.net
 Samuel Thibault                     samuel.thibault@ens-lyon.org
 Samuli Karkkainen                   Samuli.Karkkainen@hut.fi
 Sander van Malssen                  svm@kozmix.ow.nl
index 39fc0715dfc4cbee8e7196a05904cce8ee83a610..03bf012e2cac94308f612c84241a8bf13658794c 100644 (file)
@@ -294,6 +294,7 @@ Show the local time for 9AM next Friday on the west coast of the US\n\
 /* Yield the number of decimal digits needed to output a time with the
    nanosecond resolution RES, without losing information.  */
 
+ATTRIBUTE_CONST
 static int
 res_width (long int res)
 {
index 07d525c95a8d98a81402c4f4a294cda60b9a012a..eb074427cb4afd975e14f30a5d53d8eb84c0fcb1 100644 (file)
--- a/src/tee.c
+++ b/src/tee.c
@@ -185,6 +185,7 @@ main (int argc, char **argv)
 /* Return the index of the first non-null descriptor after idx,
    or -1 if all are null.  */
 
+ATTRIBUTE_PURE
 static int
 get_next_out (FILE **descriptors, int nfiles, int idx)
 {