Use cstring_to_text_with_len when length is known.
This avoids a potentially-expensive extra call to strlen(). David Rowley
This commit is contained in:
parent
4c697d8f48
commit
f1df4731ee
@ -56,5 +56,5 @@ fsm_page_contents(PG_FUNCTION_ARGS)
|
|||||||
}
|
}
|
||||||
appendStringInfo(&sinfo, "fp_next_slot: %d\n", fsmpage->fp_next_slot);
|
appendStringInfo(&sinfo, "fp_next_slot: %d\n", fsmpage->fp_next_slot);
|
||||||
|
|
||||||
PG_RETURN_TEXT_P(cstring_to_text(sinfo.data));
|
PG_RETURN_TEXT_P(cstring_to_text_with_len(sinfo.data, sinfo.len));
|
||||||
}
|
}
|
||||||
|
@ -1499,7 +1499,7 @@ array_to_json(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
array_to_json_internal(array, result, false);
|
array_to_json_internal(array, result, false);
|
||||||
|
|
||||||
PG_RETURN_TEXT_P(cstring_to_text(result->data));
|
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1516,7 +1516,7 @@ array_to_json_pretty(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
array_to_json_internal(array, result, use_line_feeds);
|
array_to_json_internal(array, result, use_line_feeds);
|
||||||
|
|
||||||
PG_RETURN_TEXT_P(cstring_to_text(result->data));
|
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1532,7 +1532,7 @@ row_to_json(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
composite_to_json(array, result, false);
|
composite_to_json(array, result, false);
|
||||||
|
|
||||||
PG_RETURN_TEXT_P(cstring_to_text(result->data));
|
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1549,7 +1549,7 @@ row_to_json_pretty(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
composite_to_json(array, result, use_line_feeds);
|
composite_to_json(array, result, use_line_feeds);
|
||||||
|
|
||||||
PG_RETURN_TEXT_P(cstring_to_text(result->data));
|
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1607,7 +1607,7 @@ to_json(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
datum_to_json(val, false, result, tcategory, typoutput);
|
datum_to_json(val, false, result, tcategory, typoutput);
|
||||||
|
|
||||||
PG_RETURN_TEXT_P(cstring_to_text(result->data));
|
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1733,7 +1733,7 @@ json_agg_finalfn(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
appendStringInfoChar(state, ']');
|
appendStringInfoChar(state, ']');
|
||||||
|
|
||||||
PG_RETURN_TEXT_P(cstring_to_text(state->data));
|
PG_RETURN_TEXT_P(cstring_to_text_with_len(state->data, state->len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user