]> git.ipfire.org Git - thirdparty/make.git/commit
Provide new functions to convert long long to string
authorPaul Smith <psmith@gnu.org>
Sun, 25 Sep 2022 20:12:21 +0000 (16:12 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 25 Sep 2022 20:57:31 +0000 (16:57 -0400)
commitf3640ecf4fa5edd34d1bd4409557a2fccf1585a8
tree06f2791af65e582d586618ff058d752aea4c8401
parentc4e232e44f00be75ba58bc5f12e7562a62028fe9
Provide new functions to convert long long to string

The previous attempt to use PRI* macros to avoid compiler-specific
printf format specifiers didn't work because we are using raw
long long type, not the uintX_t types.  On systems where long and
long long are the same size, uint64_t might be type "long" and PRId64
is just "ld".

Instead write new functions that convert [unsigned] long long to a
string and call those instead.

* src/makeint.h: Declare make_lltoa() and make_ulltoa().
* src/misc.c (make_lltoa): New function that writes a long long value
into a provided buffer.  Return the buffer for ease-of-use.
(make_ulltoa): Ditto, for unsigned long long.
* src/function.c (func_wordlist): Call these new methods.  Also
rework the error strings so we share the translated string.
* src/dir.c (print_dir_data_base): Call the new methods instead of
using MSVC macros.
src/dir.c
src/function.c
src/makeint.h
src/misc.c