Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf1df473

Browse files
committed
Use cstring_to_text_with_len when length is known.
This avoids a potentially-expensive extra call to strlen().David Rowley
1 parent4c697d8 commitf1df473

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

‎contrib/pageinspect/fsmfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ fsm_page_contents(PG_FUNCTION_ARGS)
5656
}
5757
appendStringInfo(&sinfo,"fp_next_slot: %d\n",fsmpage->fp_next_slot);
5858

59-
PG_RETURN_TEXT_P(cstring_to_text(sinfo.data));
59+
PG_RETURN_TEXT_P(cstring_to_text_with_len(sinfo.data,sinfo.len));
6060
}

‎src/backend/utils/adt/json.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ array_to_json(PG_FUNCTION_ARGS)
14991499

15001500
array_to_json_internal(array,result, false);
15011501

1502-
PG_RETURN_TEXT_P(cstring_to_text(result->data));
1502+
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data,result->len));
15031503
}
15041504

15051505
/*
@@ -1516,7 +1516,7 @@ array_to_json_pretty(PG_FUNCTION_ARGS)
15161516

15171517
array_to_json_internal(array,result,use_line_feeds);
15181518

1519-
PG_RETURN_TEXT_P(cstring_to_text(result->data));
1519+
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data,result->len));
15201520
}
15211521

15221522
/*
@@ -1532,7 +1532,7 @@ row_to_json(PG_FUNCTION_ARGS)
15321532

15331533
composite_to_json(array,result, false);
15341534

1535-
PG_RETURN_TEXT_P(cstring_to_text(result->data));
1535+
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data,result->len));
15361536
}
15371537

15381538
/*
@@ -1549,7 +1549,7 @@ row_to_json_pretty(PG_FUNCTION_ARGS)
15491549

15501550
composite_to_json(array,result,use_line_feeds);
15511551

1552-
PG_RETURN_TEXT_P(cstring_to_text(result->data));
1552+
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data,result->len));
15531553
}
15541554

15551555
/*
@@ -1607,7 +1607,7 @@ to_json(PG_FUNCTION_ARGS)
16071607

16081608
datum_to_json(val, false,result,tcategory,typoutput);
16091609

1610-
PG_RETURN_TEXT_P(cstring_to_text(result->data));
1610+
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data,result->len));
16111611
}
16121612

16131613
/*
@@ -1733,7 +1733,7 @@ json_agg_finalfn(PG_FUNCTION_ARGS)
17331733

17341734
appendStringInfoChar(state,']');
17351735

1736-
PG_RETURN_TEXT_P(cstring_to_text(state->data));
1736+
PG_RETURN_TEXT_P(cstring_to_text_with_len(state->data,state->len));
17371737
}
17381738

17391739
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp