Re: Text <-> C string

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brendan Jurd <direvus(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Text <-> C string
Date: 2008-03-25 18:08:19
Message-ID: 20080325180819.GE12129@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane escribió:
> "Brendan Jurd" <direvus(at)gmail(dot)com> writes:

> > A text_to_cstring_with_len() or text_to_cstring_limit() might be more
> > to the point, and more consistent with the other functions in the
> > family.
>
> Hmm. The thing that's bothering me is that the length is the size
> of the *destination*, which is not like cstring_to_text_with_len,
> so using a closely similar name might be confusing. Of those two
> I'd go with text_to_cstring_limit. Another thought that comes to
> mind is
>
> void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len)

text_to_cstring_buffer seems okay. I did wonder for a bit whether it
should be

void text_to_cstring_buffer(const text *src, char *buf, size_t buf_len)

but then the src/dst pair seems better than src/buf.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-03-25 18:11:30 Re: gcc 4.3 breaks ContribCheck in 8.2 and older.
Previous Message Bruce Momjian 2008-03-25 18:05:57 Re: Text <-> C string

Browse pgsql-patches by date

  From Date Subject
Next Message Pavel Stehule 2008-03-25 19:03:44 Re: Text <-> C string
Previous Message Bruce Momjian 2008-03-25 18:05:57 Re: Text <-> C string