formatting.c cleanup: Change fill_str() return type to void
authorPeter Eisentraut <[email protected]>
Fri, 31 Oct 2025 08:53:01 +0000 (09:53 +0100)
committerPeter Eisentraut <[email protected]>
Fri, 31 Oct 2025 08:55:12 +0000 (09:55 +0100)
The return value is not used anywhere.

In passing, add a comment explaining the function's arguments.

Reviewed-by: Chao Li <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org

src/backend/utils/adt/formatting.c

index 05cc711ab35f2fb470365532a94cd4448ca71558..5f7b3114da732a4747ff7409a07e6a689bedd627 100644 (file)
@@ -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 */