]> granicus.if.org Git - postgresql/commitdiff
Rename PQsslAttributes() to PQsslAttributeNames(), and const-ify fully.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 7 Nov 2015 21:13:49 +0000 (16:13 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 7 Nov 2015 21:13:49 +0000 (16:13 -0500)
Per discussion, the original name was a bit misleading, and
PQsslAttributeNames() seems more apropos.  It's not quite too late to
change this in 9.5, so let's change it while we can.

Also, make sure that the pointer array is const, not only the pointed-to
strings.

Minor documentation wordsmithing while at it.

Lars Kanis, slight adjustments by me

doc/src/sgml/libpq.sgml
doc/src/sgml/release-9.5.sgml
src/interfaces/libpq/exports.txt
src/interfaces/libpq/fe-secure-openssl.c
src/interfaces/libpq/fe-secure.c
src/interfaces/libpq/libpq-fe.h

index 0ee018edd2a722ee1d6fae783afc8b3f972bfec8..cffabbc8f7ec109e5de97e1879e4674b65c7aaff 100644 (file)
@@ -1873,7 +1873,7 @@ int PQsslInUse(const PGconn *conn);
      </listitem>
     </varlistentry>
 
-    <varlistentry id="libpq-pqsslAttribute">
+    <varlistentry id="libpq-pqsslattribute">
      <term><function>PQsslAttribute</function><indexterm><primary>PQsslAttribute</></></term>
      <listitem>
       <para>
@@ -1947,13 +1947,13 @@ const char *PQsslAttribute(const PGconn *conn, const char *attribute_name);
      </listitem>
     </varlistentry>
 
-    <varlistentry id="libpq-pqsslattributes">
-     <term><function>PQsslAttributes</function><indexterm><primary>PQsslAttributes</></></term>
+    <varlistentry id="libpq-pqsslattributenames">
+     <term><function>PQsslAttributeNames</function><indexterm><primary>PQsslAttributeNames</></></term>
      <listitem>
       <para>
        Return an array of SSL attribute names available. The array is terminated by a NULL pointer.
 <synopsis>
-const char **PQsslAttributes(const PGconn *conn);
+const char * const * PQsslAttributeNames(const PGconn *conn);
 </synopsis>
       </para>
      </listitem>
@@ -1963,15 +1963,15 @@ const char **PQsslAttributes(const PGconn *conn);
      <term><function>PQsslStruct</function><indexterm><primary>PQsslStruct</></></term>
      <listitem>
       <para>
-       Return a pointer to an SSL-implementation specific object describing
+       Return a pointer to an SSL-implementation-specific object describing
        the connection.
 <synopsis>
 void *PQsslStruct(const PGconn *conn, const char *struct_name);
 </synopsis>
       </para>
       <para>
-       The structs available depends on the SSL implementation in use.
-       For OpenSSL, there is one struct, under the name "OpenSSL",
+       The struct(s) available depend on the SSL implementation in use.
+       For OpenSSL, there is one struct, available under the name "OpenSSL",
        and it returns a pointer to the OpenSSL <literal>SSL</literal> struct.
        To use this function, code along the following lines could be used:
 <programlisting><![CDATA[
index 9055387832a2017d76709f93ee5328ceb6525a1b..771ad0ca6fac80d8db90b0d3bc0e351ccc3b9530 100644 (file)
@@ -608,18 +608,22 @@ FIXME: Add Andres
 2015-02-03 [91fa7b4] Heikki..: Add API functions to libpq to interrogate SSL ..
 -->
        <para>
-        Add <application>libpq</> function <link
-        linkend="libpq-pqsslAttribute"><function>PQsslAttribute()</></>
-        that returns <acronym>SSL</> information (Heikki Linnakangas)
-       </para>
-
-       <para>
-        While <link linkend="libpq-pqgetssl"><function>PQgetssl()</></>
-        can still be used to call <productname>OpenSSL</>
-        functions, <function>PQsslAttribute()</> returns <acronym>SSL</>
-        information in an <acronym>SSL</>-implementation-independent way.
-        (Future versions of libpq might support other <acronym>SSL</>
-        implementations.)
+        Add <application>libpq</> functions to return <acronym>SSL</>
+        information in an implementation-independent way (Heikki Linnakangas)
+       </para>
+
+       <para>
+        While <link linkend="libpq-pqgetssl"><function>PQgetssl()</></> can
+        still be used to call <productname>OpenSSL</> functions, it is now
+        considered deprecated because future versions
+        of <application>libpq</> might support other <acronym>SSL</>
+        implementations.  When possible, use the new
+        functions <link
+        linkend="libpq-pqsslattribute"><function>PQsslAttribute()</></>, <link
+        linkend="libpq-pqsslattributenames"><function>PQsslAttributeNames()</></>,
+        and <link linkend="libpq-pqsslinuse"><function>PQsslInUse()</></>
+        to obtain <acronym>SSL</> information in
+        an <acronym>SSL</>-implementation-independent way.
        </para>
       </listitem>
 
index 0bbcae51bbca204db1ccb749a4017036a59809d9..c69a4d5ea4266d46bc4eb58f608c856f44b4fd95 100644 (file)
@@ -167,6 +167,6 @@ lo_truncate64             164
 PQconninfo                165
 PQsslInUse                166
 PQsslStruct               167
-PQsslAttributes           168
+PQsslAttributeNames       168
 PQsslAttribute            169
 PQsetErrorContextVisibility 170
index 4b2a324634bbefc42941772bfcec625f78b80c58..45ad7321bbed4ecdfb47384eca8e24ea66308374 100644 (file)
@@ -1532,10 +1532,10 @@ PQsslStruct(PGconn *conn, const char *struct_name)
        return NULL;
 }
 
-const char **
-PQsslAttributes(PGconn *conn)
+const char *const *
+PQsslAttributeNames(PGconn *conn)
 {
-       static const char *result[] = {
+       static const char *const result[] = {
                "library",
                "key_bits",
                "cipher",
index db91e52ee90fcc9acb522fd366e22784df2b8412..aa5af7340fe4297ba5623b4aceffdabe74edc482 100644 (file)
@@ -408,10 +408,10 @@ PQsslAttribute(PGconn *conn, const char *attribute_name)
        return NULL;
 }
 
-const char **
-PQsslAttributes(PGconn *conn)
+const char *const *
+PQsslAttributeNames(PGconn *conn)
 {
-       static const char *result[] = {NULL};
+       static const char *const result[] = {NULL};
 
        return result;
 }
index 828c533c1a36ef3cdbec0231ffeee91d933ddfdf..3a521d428d12bf2566f261049307dfe13dd47400 100644 (file)
@@ -329,7 +329,7 @@ extern int  PQsetClientEncoding(PGconn *conn, const char *encoding);
 extern int     PQsslInUse(PGconn *conn);
 extern void *PQsslStruct(PGconn *conn, const char *struct_name);
 extern const char *PQsslAttribute(PGconn *conn, const char *attribute_name);
-extern const char **PQsslAttributes(PGconn *conn);
+extern const char *const * PQsslAttributeNames(PGconn *conn);
 
 /* Get the OpenSSL structure associated with a connection. Returns NULL for
  * unencrypted connections or if any other TLS library is in use. */