Thanks. I'll update my version.

2015-03-31 18:11 GMT+02:00 Julia Lawall <[email protected]>:

>
>
> On Tue, 31 Mar 2015, François Armand wrote:
>
> > I'm on Ubuntu 14.04
> > spatch version 1.0.0-rc19 with Python support and with PCRE support
>
> The current release is 1.0.0-rc24.  For Ubuntu, rc22 is available as a
> PPA: https://launchpad.net/~npalix/+archive/ubuntu/coccinelle.  Or you can
> just get the github version: https://github.com/coccinelle/coccinelle
>
> julia
>
> >
> >
> >
> > 2015-03-31 17:49 GMT+02:00 Julia Lawall <[email protected]>:
> >
> >
> >       On Tue, 31 Mar 2015, François Armand wrote:
> >
> >       > Better send my real stuff, than making misleading typos :-)
> >       >
> >       > My code:
> >       > #define MAX_RETRIES 3
> >       >
> >       > tmy_status
> >       > my_getattr_timeout(tmy_ctx *ctx,
> >       >            u64 ino)
> >       > {
> >       >   tmy_status ret;
> >       >   int tries = 0;
> >       >   int delay = 1;
> >       >
> >       >  retry:
> >       >   ret = my_getattr(ctx, ino);
> >       >   if (MY_SUCCESS != ret)
> >       >     {
> >       >       if (MY_ENOENT != ret &&
> >       >           MY_EPERM != ret)
> >       >         {
> >       >           if (tries < MAX_RETRIES)
> >       >             {
> >       >               HANDLE_TIMEOUT(tries, delay, "ino %llu", ino);
> >       >               goto retry;
> >       >             }
> >       >           else
> >       >             {
> >       >               MY_TRACE(MY_ERROR, 0u, "getattr: ino %llu"": I/O
> >       error", ino);
> >       >               return MY_FAILURE;
> >       >             }
> >       >         }
> >       >     }
> >       >   return ret;
> >       > }
> >       >
> >       > A working patch
> >       > @@
> >       > expression t;
> >       > constant M;
> >       > @@
> >       >        if (
> >       > -       t < M
> >       > +          foo(&ctx->retry_ctx)
> >       >           )
> >       >           {
> >       >       ...
> >       >       } else {
> >       >       ...
> >       >       }
> >       >
> >       > A patch I can't make to work. That last one exists w/o
> >       producing anything
> >       >
> >       > @@
> >       > expression t;
> >       > constant M;
> >       > @@
> >       >  if (...)
> >       >  {
> >       >     if (...)
> >       >     {
> >       >        if (
> >       > -       t < M
> >       > +          foo(&ctx->retry_ctx)
> >       >           )
> >       >           {
> >       >       ...
> >       >       } else {
> >       >       ...
> >       >       }
> >       >     }
> >       >   }
> >
> > It seems to work fine for me:
> >
> > @@ -15,7 +15,7 @@ my_getattr_timeout(tmy_ctx *ctx,
> >              if (MY_ENOENT != ret &&
> >                           MY_EPERM != ret)
> >                 {
> > -                 if (tries < MAX_RETRIES)
> > +                 if (foo(&ctx->retry_ctx))
> >                       {
> >                         HANDLE_TIMEOUT(tries, delay, "ino %llu", ino);
> >                       goto retry;
> >
> > What version of Coccinelle do you have?
> >
> > julia
> >
> >
> >
> >
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to