Re: Conflicting declarations for b64_encode etc. on Solaris 11.4 Beta

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Rainer Orth <ro(at)CeBiTec(dot)Uni-Bielefeld(dot)DE>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Conflicting declarations for b64_encode etc. on Solaris 11.4 Beta
Date: 2018-01-24 02:16:11
Message-ID: 20180124015251.GA14001@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Jan 23, 2018 at 04:45:50PM +0100, Rainer Orth wrote:
> There are already a couple of instances of those functions with a pg_
> prefix, obviously to avoid conflict with differing b64_{encode,decode}
> declarations on other systems, but they don't match exactly:
> e.g. src/include/common/base64.h has
>
> extern int pg_b64_encode(const char *src, int len, char *dst);
> extern int pg_b64_decode(const char *src, int len, char *dst);

Those are new as of v10, being used by the SCRAM implementation with a
more generic API designed for this purpose. The main difference with
what is in encode.c is the whitespace handling to cope with what RFC
5802 requires.

> while the encode.c and pgp-armor.c versions use an unsigned return value
> and len argument.
>
> However, since those two latter versions are static, adding a pg_ prefix
> there, too, worked without conflict, allowed the compilation to finish
> and make check to succeed.

I am not much a fan of using the same function name for both the static
functions in pgcrypto and encode.c, as well as what is in
src/common/. In order to avoid any conflicts, why not just changing at
least the prefix from "b64" to "base64"? That's not completely
problem-proof for the problem either, as php has a base64_encode for
example. So my suggestion would be to change the prefix on all branches
and to append pg_ to all the routines in encode.c for
consistency. Better naming suggestions welcome.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2018-01-24 02:51:30 Re: minor annoyance - search_path not reset in/after dump/restore
Previous Message Bruce Momjian 2018-01-23 23:23:19 Re: BUG #14912: Undocumented: 'psql -l' assumes database 'postgresql' not $USER