pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Have pg_itoa, pg_ltoa and pg_lltoa return the length of the stri
Date: Sat, 13 Jun 2020 00:32:26 +0000
Message-ID: <E1jju5y-0004XR-J8@gemulon.postgresql.org> (raw)

Have pg_itoa, pg_ltoa and pg_lltoa return the length of the string

Core by no means makes excessive use of these functions, but quite a large
number of those usages do require the caller to call strlen() on the
returned string.  This is quite wasteful since these functions do already
have a good idea of the length of the string, so we might as well just
have them return that.

Reviewed-by: Andrew Gierth
Discussion: https://postgr.es/m/CAApHDvrm2A5x2uHYxsqriO2cUaGcFvND%2BksC9e7Tjep0t2RK_A%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dad75eb4a8d5835ecc795d7a7978e7702e4d5912

Modified Files
--------------
src/backend/access/common/printsimple.c | 10 ++++++----
src/backend/utils/adt/int.c             |  4 +---
src/backend/utils/adt/int8.c            | 11 +++++++++--
src/backend/utils/adt/numutils.c        | 32 +++++++++++++++++++-------------
src/include/utils/builtins.h            |  6 +++---
5 files changed, 38 insertions(+), 25 deletions(-)



Message-ID: <E1jju5y-0004XR-J8@gemulon.postgresql.org>
Permalink:  ../E1jju5y-0004XR-J8@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jju5y-0004XR-J8@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org
  Subject: Re: pgsql: Have pg_itoa, pg_ltoa and pg_lltoa return the length of the stri
  In-Reply-To: <E1jju5y-0004XR-J8@gemulon.postgresql.org>
  References: <E1jju5y-0004XR-J8@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox