From: Peter Eisentraut Date: Fri, 17 Jan 2025 07:06:24 +0000 (+0100) Subject: Add pg_nodiscard decorations to base64 functions X-Git-Tag: REL_18_BETA1~1072 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=b0eff1098860f88dd385e6882ff7b1063d267213;p=postgresql.git Add pg_nodiscard decorations to base64 functions The result of pg_b64_encode() and pg_b64_decode() should be checked for errors. This attribute could detect mistakes such as those fixed in commit ff030ebe250 and d278541be42. Reviewed-by: Michael Paquier Reviewed-by: Ranier Vilela Discussion: https://www.postgresql.org/message-id/flat/CAEudQAq-3yHsSdWoOOaw%2BgAQYgPMpMGuB5pt2yCXgv-YuxG2Hg%40mail.gmail.com --- diff --git a/src/include/common/base64.h b/src/include/common/base64.h index 2d88d31c874..b064275bbb4 100644 --- a/src/include/common/base64.h +++ b/src/include/common/base64.h @@ -11,8 +11,8 @@ #define BASE64_H /* base 64 */ -extern int pg_b64_encode(const char *src, int len, char *dst, int dstlen); -extern int pg_b64_decode(const char *src, int len, char *dst, int dstlen); +extern pg_nodiscard int pg_b64_encode(const char *src, int len, char *dst, int dstlen); +extern pg_nodiscard int pg_b64_decode(const char *src, int len, char *dst, int dstlen); extern int pg_b64_enc_len(int srclen); extern int pg_b64_dec_len(int srclen);