Minor bug in error message in datetime.c

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Minor bug in error message in datetime.c

Oleh Khoma
Hi,



I have spotted a minor bug in do_strptime() function. Here is a patch:



--- a/src/main/datetime.c

+++ b/src/main/datetime.c

@@ -1048,7 +1048,7 @@ SEXP attribute_hidden do_strptime(SEXP call, SEXP op, SEXP args, SEXP env)

     if(!isString((x = CAR(args))))

        error(_("invalid '%s' argument"), "x");

     if(!isString((sformat = CADR(args))) || XLENGTH(sformat) == 0)

-       error(_("invalid '%s' argument"), "x");

+       error(_("invalid '%s' argument"), "format");



One could spend quite some time figuring out what is wrong with his “x”, when the problem is with “format” :)







Kind regards,

Oleh Khoma

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Minor bug in error message in datetime.c

Martin Maechler
>>>>> Oleh Khoma
>>>>>     on Mon, 20 Jan 2020 15:34:05 +0000 writes:

    > Hi,
    > I have spotted a minor bug in do_strptime() function. Here is a patch:



    > --- a/src/main/datetime.c

    > +++ b/src/main/datetime.c

    > @@ -1048,7 +1048,7 @@ SEXP attribute_hidden do_strptime(SEXP call, SEXP op, SEXP args, SEXP env)

    > if(!isString((x = CAR(args))))

    > error(_("invalid '%s' argument"), "x");

    > if(!isString((sformat = CADR(args))) || XLENGTH(sformat) == 0)

    > -       error(_("invalid '%s' argument"), "x");

    > +       error(_("invalid '%s' argument"), "format");



    > One could spend quite some time figuring out what is wrong with his “x”, when the problem is with “format” :)



Thank you, Oleh.
This has indeed been a cut'n'paste lapsus quite a while ago,
undetected till now.

It's fixed now (but I'll add a regression test later).

Martin



    > Kind regards,

    > Oleh Khoma

    > [[alternative HTML version deleted]]

    > ______________________________________________
    > [hidden email] mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel