> --- array-released.diff 2019-11-14 21:29:11.020576916 +0100
> +++ array-reduced1.diff 2019-11-14 21:45:58.931956527 +0100
> @@ -6,24 +6,10 @@
> r->entry_count = t->entry_count;
> r->delta_depth = t->delta_depth;
> - memcpy(r->entries,t->entries,t->entry_count*sizeof(t->entries[0]));
> -+ COPY_ARRAY(r->entries, t->entries, t->entry_count);
> ++ memcpy(r->entries,t->entries,t->entry_count*sizeof(*(t->entries)));
> release_tree_content(t);
> return r;
> }
Can another variant for a transformation rule help to clarify unexpected
software behaviour around data processing with the semantic patch language?
@@
expression dst, src, n, E;
type T;
T *ptr;
T[] arr;
@@
memcpy(
( dst, src, sizeof(
+ *(
E
- [...]
+ )
) * n
|
ptr, src, sizeof(
- *(ptr)
+ T
) * n
| arr, src, sizeof(
- *(arr)
+ T
) * n
| dst, ptr, sizeof(
- *(ptr)
+ T
) * n
| dst, arr, sizeof(
- *(arr)
+ T
) * n
)
)
elfring@Sonne:~/Projekte/git/lokal> spatch contrib/coccinelle/array-test3.cocci
fast-import.c
…
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci