This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Use long long in _itoa and _itowa if PREFER_LONG_LONG is defined
This is probably fine, but maximal paranoia dictates that the first change
should be just moving the file and changing the #include's. Then a second
change can go in adding the macro stuff. So please do just the renaming
change first (go ahead and commit it, no need to post again), and then post
the (much smaller) patch that changes the substance.
> diff --git a/stdio-common/_itowa.h b/stdio-common/_itowa.h
> index 0f33311..9d94ef1 100644
> --- a/stdio-common/_itowa.h
> +++ b/stdio-common/_itowa.h
> @@ -20,18 +20,26 @@
> #define _ITOWA_H 1
> #include <features.h>
> #include <wchar.h>
> +#include <limits.h>
>
> /* Convert VALUE into ASCII in base BASE (2..36).
> Write backwards starting the character just before BUFLIM.
> Return the address of the first (left-to-right) character in the number.
> Use upper case letters iff UPPER_CASE is nonzero. */
>
> +#ifndef _ITOWA_NEEDED
> +# define _ITOWA_NEEDED (LONG_MAX != LLONG_MAX)
> +#endif
> +#ifndef _ITOWA_WORD_TYPE
> +# define _ITOWA_WORD_TYPE unsigned long int
> +#endif
> +
> extern wchar_t *_itowa (unsigned long long int value, wchar_t *buflim,
> unsigned int base, int upper_case);
Don't separate the comment from the declaration like this.
Put the macros before the comment.
> +/* Convert VALUE into ASCII in base BASE (2..36).
> + Write backwards starting the character just before BUFLIM.
> + Return the address of the first (left-to-right) character in the number.
> + Use upper case letters iff UPPER_CASE is nonzero. */
> +
> +#ifndef _ITOA_NEEDED
> +# define _ITOA_NEEDED (LONG_MAX != LLONG_MAX)
> +#endif
> +#ifndef _ITOA_WORD_TYPE
> +# define _ITOA_WORD_TYPE unsigned long int
> +#endif
> +
> +extern char *_itoa (unsigned long long int value, char *buflim,
> + unsigned int base, int upper_case);
Likewise.
Thanks,
Roland