Re: svn commit: r8341 - trunk/subversion/libsvn_subr

Jani Averbach <[email protected]> Fri, 16 Jan 2004 11:30:04 -0700
Newsgroups gmane.mail.eyebrowse.devel,gmane.comp.version-control.subversion.svn
Message-ID <[email protected]>
On 2004-01-16 11:59-0600, [email protected] wrote:

Sorry about jumping to topic in this late phase, but:

> +#define WIN32_RETRY_LOOP(err, expr)                                        \
> +  {                                                                        \
> +    int retries = 0;                                                       \
> +    int sleep_count = 1000;                                                \
> +                                                                           \
> +    for ( retries = 0;                                                     \
> +          APR_TO_OS_ERROR (err) == ERROR_ACCESS_DENIED && retries < 100;   \
> +          ++retries )                                                      \
> +    {                                                                      \
> +      apr_sleep (sleep_count);                                             \
> +      if (sleep_count < 128000)                                            \
> +        sleep_count *= 2;                                                  \
> +      err = expr;                                                          \
> +    }                                                                      \
> +  }

I think it is better to use construction:

#ifdef WIN32
#define WIN32_RETRY_LOOP(err, expr) \
    do { \
      ... \
    while(0)
#else
#define WIN32_RETRY_LOOP(err, expr) do {} while(0)
#endif

when you are doing function-like macros. This way the execution path of
program won't change by this macro.

BR, Jani

-- 
Jani Averbach