Thanks.  I have fixed the problem.  If you want to fix it in your code, 
then look for the CondExpr line in parsing_c/unparse_cocci, and replace it 
by the following:

 | Ast.CondExpr(exp1,why,exp2,colon,exp3) ->
      expression exp1; pr_space(); mcode print_string why;
      print_option (function e -> pr_space(); expression e) exp2;
      pr_space(); mcode print_string colon; pr_space(); expression exp3

Otherwise, just wait for the next version, which should be released in a 
few days.

julia


On Sun, 13 Jun 2010, Josh Triplett wrote:

> Hi,
> 
> I encountered a slight indentation problem in output code using the
> ternary operator.  I wrote this semantic patch:
> 
> @@
> identifier displayname;
> @@
> (
> -XDisplayName(NULL)
> +getenv("DISPLAY")
> |
> -XDisplayName(displayname)
> +displayname ? displayname : getenv("DISPLAY")
> )
> 
> And I applied it to this code:
> 
> int
> main(int argc, char *argv[])
> {
> // ...
>     dpy = XOpenDisplay (displayname);
>     if (!dpy) {
>         fprintf (stderr, "%s:  unable to open display \"%s\"\n",
>                  ProgramName, XDisplayName (displayname));
>         Exit (1);
>     }
>     screenno = DefaultScreen (dpy);
> // ...
> }
> 
> I ended up with this patch:
> 
> @@ -143,7 +143,7 @@ main(int argc, char *argv[])
>      dpy = XOpenDisplay (displayname);
>      if (!dpy) {
>         fprintf (stderr, "%s:  unable to open display \"%s\"\n",
> -                ProgramName, XDisplayName (displayname));
> +                ProgramName, displayname ? displayname :getenv("DISPLAY"));
>         Exit (1);
>      }
>      screenno = DefaultScreen (dpy);
> 
> Note the lack of a space between ':' and getenv.
> 
> - Josh Triplett
> _______________________________________________
> Cocci mailing list
> [email protected]
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
> 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to