From aa4535307e3d432f44b4c76b8ffebc5a0789250c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 31 Oct 2025 09:53:01 +0100 Subject: [PATCH] formatting.c cleanup: Change fill_str() return type to void The return value is not used anywhere. In passing, add a comment explaining the function's arguments. Reviewed-by: Chao Li Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org --- src/backend/utils/adt/formatting.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 05cc711ab35..5f7b3114da7 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1113,7 +1113,7 @@ static bool from_char_seq_search(int *dest, const char **src, static bool do_to_timestamp(const text *date_txt, const text *fmt, Oid collid, bool std, struct pg_tm *tm, fsec_t *fsec, struct fmt_tz *tz, int *fprec, uint32 *flags, Node *escontext); -static char *fill_str(char *str, int c, int max); +static void fill_str(char *str, int c, int max); static FormatNode *NUM_cache(int len, NUMDesc *Num, const text *pars_str, bool *shouldFree); static char *int_to_roman(int number); static int roman_to_int(NUMProc *Np, size_t input_len); @@ -4824,12 +4824,15 @@ fail: *********************************************************************/ -static char * +/* + * Fill str with character c max times, and add terminating \0. (So max+1 + * bytes are written altogether!) + */ +static void fill_str(char *str, int c, int max) { memset(str, c, max); str[max] = '\0'; - return str; } /* This works the same as DCH_prevent_counter_overflow */ -- 2.39.5