Thread: [PATCH] Obsolete wording in PL/Perl comment

[PATCH] Obsolete wording in PL/Perl comment

From
ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Date:
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


Re: [PATCH] Obsolete wording in PL/Perl comment

From
Tom Lane
Date:
ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes:
> 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.

Pushed, thanks.
        regards, tom lane