[PATCH] replace: Replace BSD strtoll by wrapping strtoll instead of strtoq

Felix Janda felix.janda at posteo.de
Tue May 5 11:23:05 MDT 2015

Volker Lendecke wrote:
> On Sun, May 03, 2015 at 08:40:57AM +0200, Felix Janda wrote:
> > When it is detected that strtoll returns EINVAL not only in the case
> > that the base is not supported, HAVE_BSD_STRTOLL is declared and
> > strtoll is replaced. The current replacement code wraps strtoq in
> > order to replace strtoll and errors out when strtoq is missing.
> > 
> > In order to remove this possible error path, we can use strtoll instead
> > of strtoq since the code is only used when it is known that strtoll exists.
> > 
> > The fixes a compilation problem on linux systems using musl libc, which
> > has a BSD-like strtoll but no strtoq.
> Isn't the point that we want to replace strtoll with
> something different, not with exactly the function we want
> to replace? I could see special error handling on top of
> strtoll/EINVAL. Alternatively, we should fully implement
> strtoll ourselves for the platforms that neither have
> strtoll the way we expect it nor strtoq.

The replacement is not exactly the same as the function it replaces,
see the code. It realizes your first suggestion.

On BSD strtoq and strtoll behave exactly the same (except that strtoq
returns a quad_t). The current use of strtoq just makes the replacement
unecessarily unportable.


More information about the samba-technical mailing list