On Tue, 30 Jun 2015, Aaen, Andreas.Bach wrote:

> Julia wrote:
> >Do you just want to put
> >... when != E3
> >    when strict
> >
> >here?  The when strict ensures it checks everything, including things that 
> >it interprets as error exits.
> 
> How can this cope with a c-code like this?
> 
>     str = PyString_FromString(textlic);
>     PyDict_SetItemString(entry, "Licenceplate", str);
>     Py_DECREF(str);
> 
>     str = PyString_FromString(textday);
>     PyDict_SetItemString(entry, "Day", str);
>     Py_DECREF(str);
> 
>     str = PyString_FromString(textsix);
>     PyDict_SetItemString(entry, "SortIndex", str);
>     Py_DECREF(str);
> 
> The str pointer must have a Py_DECREF() after each call to PyDictItemString() 
> before the str pointer is reused to point to a new object. In the above 
> example you have three scopes of the str pointer. The compiler most probably 
> know this.

After the ... that I suggested, put

? str = E

That will make the ... stop at the first reassignment to str, if there is 
one.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to