From 566cfb07b6ec46fd70cba8239be8e6ed1ac2851f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 8 Sep 2024 23:54:30 -0700 Subject: [PATCH] crc.h: declare each function with _GL_ATTRIBUTE_PURE * lib/crc.h (crc32, crc32_update, crc32_no_xor) (crc32_update_no_xor): Declare with _GL_ATTRIBUTE_PURE. --- ChangeLog | 6 ++++++ lib/crc.h | 11 +++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f87bc0f741..a0d0a4084b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-09-08 Jim Meyering + + crc.h: declare each function with _GL_ATTRIBUTE_PURE + * lib/crc.h (crc32, crc32_update, crc32_no_xor) + (crc32_update_no_xor): Declare with _GL_ATTRIBUTE_PURE. + 2024-09-05 Paul Eggert Fix COPYING.EXCEPTION license notices diff --git a/lib/crc.h b/lib/crc.h index 4014216cc3..2754126dbe 100644 --- a/lib/crc.h +++ b/lib/crc.h @@ -28,18 +28,20 @@ extern "C" { /* Compute CRC-32 value of LEN bytes long BUF, and return it. */ -extern uint32_t crc32 (const char *buf, size_t len); +extern uint32_t crc32 (const char *buf, size_t len) _GL_ATTRIBUTE_PURE; /* Incrementally update CRC-32 value CRC using LEN bytes long BUF. In the first call, use 0 as the value for CRC. Return the updated CRC-32 value. */ -extern uint32_t crc32_update (uint32_t crc, const char *buf, size_t len); +extern uint32_t crc32_update (uint32_t crc, const char *buf, size_t len) + _GL_ATTRIBUTE_PURE; /* Compute modified-CRC-32 value of LEN bytes long BUF, and return it. The "modification" is to avoid the initial and final XOR operation. Due to historic implementation errors, this variant is sometimes used (i.e., in RFC 3961). */ -extern uint32_t crc32_no_xor (const char *buf, size_t len); +extern uint32_t crc32_no_xor (const char *buf, size_t len) + _GL_ATTRIBUTE_PURE; /* Incrementally update modified-CRC-32 value CRC using LEN bytes long BUF. In the first call, use 0 as the value for CRC. Return the @@ -47,7 +49,8 @@ extern uint32_t crc32_no_xor (const char *buf, size_t len); initial and final XOR operation. Due to historic implementation errors, this variant is sometimes used (i.e., in RFC 3961). */ extern uint32_t -crc32_update_no_xor (uint32_t crc, const char *buf, size_t len); +crc32_update_no_xor (uint32_t crc, const char *buf, size_t len) + _GL_ATTRIBUTE_PURE; #ifdef __cplusplus -- 2.39.5