Re: Use PointerGetDatum(cstring_to_text_with_len()) instead of CStringGetTextDatum() to avoid duplicate strlen

2020-10-19 Thread Heikki Linnakangas
On 19/10/2020 09:32, Hou, Zhijie wrote: Hi I found some code like the following: StringInfoData s; ... values[6] = CStringGetTextDatum(s.data); The length of string can be found in ' StringInfoData.len', but the macro CStringGetTextDatum will use strlen to count the length again. I think we

Use PointerGetDatum(cstring_to_text_with_len()) instead of CStringGetTextDatum() to avoid duplicate strlen

2020-10-19 Thread Hou, Zhijie
Hi I found some code like the following: > StringInfoData s; > ... > values[6] = CStringGetTextDatum(s.data); The length of string can be found in ' StringInfoData.len', but the macro CStringGetTextDatum will use strlen to count the length again. I think we can use