[PATCH] Obsolete wording in PL/Perl comment - Mailing list pgsql-hackers

From ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Subject [PATCH] Obsolete wording in PL/Perl comment
Date
Msg-id d8j4mcab3e5.fsf@dalvik.ping.uio.no
Whole thread Raw
Responses Re: [PATCH] Obsolete wording in PL/Perl comment
List pgsql-hackers
The comment in hv_store_string() says that negative key length to
hv_store() for UTF-8 is not documented, and mentions that 5.6 doesn't
track UTF-8-ness of keys.  However, the negative length convention has
been documented since 5.16¹, and 5.6 is no longer supported.  The
attached patch updates the comment to reflect this.

[1]: http://perldoc.perl.org/perlapi.html#hv_store

--
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
 the consequences of."                              -- Skud's Meta-Law

>From 9dfe4c076b5040557dec694dee91701438d658fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Sun, 13 Mar 2016 02:46:45 +0000
Subject: [PATCH] Fix obsolete wording in PL/Perl hv_store_string comment

Negative klen is documented since Perl 5.16, and 5.6 is no longer
supported.
---
 src/pl/plperl/plperl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 269f7f3..a659695 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -3911,10 +3911,8 @@ hv_store_string(HV *hv, const char *key, SV *val)
     hkey = pg_server_to_any(key, strlen(key), PG_UTF8);

     /*
-     * This seems nowhere documented, but under Perl 5.8.0 and up, hv_store()
-     * recognizes a negative klen parameter as meaning a UTF-8 encoded key. It
-     * does not appear that hashes track UTF-8-ness of keys at all in Perl
-     * 5.6.
+     * hv_store() recognizes a negative klen parameter as meaning a UTF-8
+     * encoded key
      */
     hlen = -(int) strlen(hkey);
     ret = hv_store(hv, hkey, hlen, val, 0);
--
2.7.0


pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: Re: memory leak in GIN
Next
From: Jim Nasby
Date:
Subject: Re: Improve error handling in pltcl