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 PointerGetDatum(cstring_to_text_with_len(s.data, s.len)) to improve. > #define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s)) > text * > cstring_to_text(const char *s) > { > return cstring_to_text_with_len(s, strlen(s)); > } There may have more places that can get the length of string in advance, But that may need new variable to store it ,So I just find all StringInfoData cases. Best regards, houzj
0001-prevent-duplicate-strlen.patch
Description: 0001-prevent-duplicate-strlen.patch