From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Brendan Jurd" <direvus(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Text <-> C string |
Date: | 2008-03-25 17:45:52 |
Message-ID: | 28064.1206467152@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
"Brendan Jurd" <direvus(at)gmail(dot)com> writes:
> On 26/03/2008, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> ... What I think is more useful is
>> a strlcpy()-like function that copies into a caller-supplied buffer
>> of limited size. For lack of a better idea I propose defining it
>> *exactly* like strlcpy:
>>
>> extern size_t textlcpy(char *dst, const text *src, size_t siz);
> I'm all for providing a function with this behaviour, but is
> textlcpy() a bit ambiguous?
Fair enough, I'm not wedded to that name. Search-and-replace is
still easy enough at this point ...
> 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)
Anyone have other ideas?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Kurt Roeckx | 2008-03-25 17:52:31 | Re: gcc 4.3 breaks ContribCheck in 8.2 and older. |
Previous Message | Brendan Jurd | 2008-03-25 17:33:13 | Re: Text <-> C string |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2008-03-25 18:04:37 | Re: pg_dump -i wording |
Previous Message | Brendan Jurd | 2008-03-25 17:33:13 | Re: Text <-> C string |