From dad75eb4a8d5835ecc795d7a7978e7702e4d5912 Mon Sep 17 00:00:00 2001 From: David Rowley Date: Sat, 13 Jun 2020 12:32:00 +1200 Subject: Have pg_itoa, pg_ltoa and pg_lltoa return the length of the string Core by no means makes excessive use of these functions, but quite a large number of those usages do require the caller to call strlen() on the returned string. This is quite wasteful since these functions do already have a good idea of the length of the string, so we might as well just have them return that. Reviewed-by: Andrew Gierth Discussion: https://postgr.es/m/CAApHDvrm2A5x2uHYxsqriO2cUaGcFvND%2BksC9e7Tjep0t2RK_A%40mail.gmail.com --- src/include/utils/builtins.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/include/utils/builtins.h') diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index a5c8772e95f..f8595642da9 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -47,11 +47,11 @@ extern int namestrcmp(Name name, const char *str); extern int32 pg_atoi(const char *s, int size, int c); extern int16 pg_strtoint16(const char *s); extern int32 pg_strtoint32(const char *s); -extern void pg_itoa(int16 i, char *a); +extern int pg_itoa(int16 i, char *a); extern int pg_ultoa_n(uint32 l, char *a); extern int pg_ulltoa_n(uint64 l, char *a); -extern void pg_ltoa(int32 l, char *a); -extern void pg_lltoa(int64 ll, char *a); +extern int pg_ltoa(int32 l, char *a); +extern int pg_lltoa(int64 ll, char *a); extern char *pg_ultostr_zeropad(char *str, uint32 value, int32 minwidth); extern char *pg_ultostr(char *str, uint32 value); extern uint64 pg_strtouint64(const char *str, char **endptr, int base); -- cgit v1.2.3