Jesper, Julia,

static char *hex(char digest[16], char buff[33])
...

+++

@ grab_sizeof @
type T;
function f;
identifier x, buff;

constant bound_1, bound_2;

@@

static char *f(T x[16], char buff[33])

This could be generalised to:

static char *f(T x[bound_1], char buff[bound_2])

I'll look into the array problem.  But I'm not sure why you want to match
an array.  sizeof does the right thing on arrays.  You want to match the
pointer case.  You could try just:

It is a surprisingly common developer mistake to forget that array
parameters are implicitly converted to a pointer.

@@
expression *x;
@@

* sizeof(x)

I suspect that this has a different kind of representation in
Coccinelle.

--
Derek M. Jones                         tel: +44 (0) 1252 520 667
Knowledge Software Ltd                 mailto:[email protected]
Source code analysis                   http://www.knosof.co.uk
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to