You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ivan Zhakov via dev <de...@apr.apache.org> on 2022/06/27 18:08:08 UTC

Re: svn commit: r1902285 - /apr/apr/trunk/test/testencode.c

On Mon, 27 Jun 2022 at 21:01, <yl...@apache.org> wrote:

> Author: ylavic
> Date: Mon Jun 27 18:01:27 2022
> New Revision: 1902285
>
> URL: http://svn.apache.org/viewvc?rev=1902285&view=rev
> Log:
> testencode: Follow up to r1902281: Correct call convention for encdec_fn
> (try 2).
>
>
> Modified:
>     apr/apr/trunk/test/testencode.c
>
> Modified: apr/apr/trunk/test/testencode.c
> URL:
> http://svn.apache.org/viewvc/apr/apr/trunk/test/testencode.c?rev=1902285&r1=1902284&r2=1902285&view=diff
>
> ==============================================================================
> --- apr/apr/trunk/test/testencode.c (original)
> +++ apr/apr/trunk/test/testencode.c Mon Jun 27 18:01:27 2022
> @@ -905,7 +905,11 @@ static void test_decode_base16_binary(ab
>      apr_pool_destroy(pool);
>  }
>
> -typedef APR_DECLARE(apr_status_t) (*encdec_fn)(char*, const char*,
> apr_ssize_t, int, apr_size_t*);
> +#ifdef WIN32
> +typedef apr_status_t (__stdcall *encdec_fn)(char*, const char*,
> apr_ssize_t, int, apr_size_t*);
> +#else
> +typedef apr_status_t (*encdec_fn)(char*, const char*, apr_ssize_t, int,
> apr_size_t*);
> +#endif
>
> This uses assumptions about calling convention used on the Win32 platform.
I don't think it's a good thing. Do we really need an array of callbacks?
May just inline all these calls?

-- 
Ivan Zhakov

Re: svn commit: r1902285 - /apr/apr/trunk/test/testencode.c

Posted by Ivan Zhakov via dev <de...@apr.apache.org>.
On Mon, 27 Jun 2022 at 21:40, Yann Ylavic <yl...@gmail.com> wrote:

> On Mon, Jun 27, 2022 at 8:35 PM Ivan Zhakov <iv...@visualsvn.com> wrote:
> >
> > On Mon, 27 Jun 2022 at 21:14, Yann Ylavic <yl...@gmail.com> wrote:
> >>
> >> On Mon, Jun 27, 2022 at 8:08 PM Ivan Zhakov <iv...@visualsvn.com> wrote:
> >> >
> >> > On Mon, 27 Jun 2022 at 21:01, <yl...@apache.org> wrote:
> >> >>
> >> >> +#ifdef WIN32
> >> >> +typedef apr_status_t (__stdcall *encdec_fn)(char*, const char*,
> apr_ssize_t, int, apr_size_t*);
> >> >> +#else
> >> >> +typedef apr_status_t (*encdec_fn)(char*, const char*, apr_ssize_t,
> int, apr_size_t*);
> >> >> +#endif
> >> >>
> >> > This uses assumptions about calling convention used on the Win32
> platform. I don't think it's a good thing. Do we really need an array of
> callbacks? May just inline all these calls?
> >>
> >> APR_DECLARE() seems to always __stdcall, as opposed to
> >> APR_DECLARE_NONSTD()'s __cdecl.
> >> But I barely understand these Windows subtleties, so yeah I can inline..
> >>
> >
> > Yes, *currently* it is always a stdcall, but it could change so it's
> better do not have such assumptions.
>
> r1902286.
>
>
Looks good! Thanks!

-- 
Ivan Zhakov

Re: svn commit: r1902285 - /apr/apr/trunk/test/testencode.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Mon, Jun 27, 2022 at 8:35 PM Ivan Zhakov <iv...@visualsvn.com> wrote:
>
> On Mon, 27 Jun 2022 at 21:14, Yann Ylavic <yl...@gmail.com> wrote:
>>
>> On Mon, Jun 27, 2022 at 8:08 PM Ivan Zhakov <iv...@visualsvn.com> wrote:
>> >
>> > On Mon, 27 Jun 2022 at 21:01, <yl...@apache.org> wrote:
>> >>
>> >> +#ifdef WIN32
>> >> +typedef apr_status_t (__stdcall *encdec_fn)(char*, const char*, apr_ssize_t, int, apr_size_t*);
>> >> +#else
>> >> +typedef apr_status_t (*encdec_fn)(char*, const char*, apr_ssize_t, int, apr_size_t*);
>> >> +#endif
>> >>
>> > This uses assumptions about calling convention used on the Win32 platform. I don't think it's a good thing. Do we really need an array of callbacks? May just inline all these calls?
>>
>> APR_DECLARE() seems to always __stdcall, as opposed to
>> APR_DECLARE_NONSTD()'s __cdecl.
>> But I barely understand these Windows subtleties, so yeah I can inline..
>>
>
> Yes, *currently* it is always a stdcall, but it could change so it's better do not have such assumptions.

r1902286.

Thanks;
Yann.

Re: svn commit: r1902285 - /apr/apr/trunk/test/testencode.c

Posted by Ivan Zhakov via dev <de...@apr.apache.org>.
On Mon, 27 Jun 2022 at 21:14, Yann Ylavic <yl...@gmail.com> wrote:

> On Mon, Jun 27, 2022 at 8:08 PM Ivan Zhakov <iv...@visualsvn.com> wrote:
> >
> > On Mon, 27 Jun 2022 at 21:01, <yl...@apache.org> wrote:
> >>
> >> +#ifdef WIN32
> >> +typedef apr_status_t (__stdcall *encdec_fn)(char*, const char*,
> apr_ssize_t, int, apr_size_t*);
> >> +#else
> >> +typedef apr_status_t (*encdec_fn)(char*, const char*, apr_ssize_t,
> int, apr_size_t*);
> >> +#endif
> >>
> > This uses assumptions about calling convention used on the Win32
> platform. I don't think it's a good thing. Do we really need an array of
> callbacks? May just inline all these calls?
>
> APR_DECLARE() seems to always __stdcall, as opposed to
> APR_DECLARE_NONSTD()'s __cdecl.
> But I barely understand these Windows subtleties, so yeah I can inline..
>
>
Yes, *currently* it is always a stdcall, but it could change so it's better
do not have such assumptions.

-- 
Ivan Zhakov

Re: svn commit: r1902285 - /apr/apr/trunk/test/testencode.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Mon, Jun 27, 2022 at 8:08 PM Ivan Zhakov <iv...@visualsvn.com> wrote:
>
> On Mon, 27 Jun 2022 at 21:01, <yl...@apache.org> wrote:
>>
>> +#ifdef WIN32
>> +typedef apr_status_t (__stdcall *encdec_fn)(char*, const char*, apr_ssize_t, int, apr_size_t*);
>> +#else
>> +typedef apr_status_t (*encdec_fn)(char*, const char*, apr_ssize_t, int, apr_size_t*);
>> +#endif
>>
> This uses assumptions about calling convention used on the Win32 platform. I don't think it's a good thing. Do we really need an array of callbacks? May just inline all these calls?

APR_DECLARE() seems to always __stdcall, as opposed to
APR_DECLARE_NONSTD()'s __cdecl.
But I barely understand these Windows subtleties, so yeah I can inline..

Regards;
Yann.