# coccinelle: adjustments for array.cocci?

1 messages from 2019-11-12 to 2019-11-12. Participants: Markus Elfring.
Thread: https://gitlist.dev/t/52242

## Markus Elfring, 2019-11-12 15:08

Subject: coccinelle: adjustments for array.cocci?
Message-ID: <c978fed2-6a89-b6da-7664-9bf8c8cd5b84@web.de>
URL: https://gitlist.dev/e/c978fed2-6a89-b6da-7664-9bf8c8cd5b84%40web.de

```
Hello,

I would like to comment implementation details from
the commit 177fbab747da4f58cb2a8ce010b3515c86dd67c9 ("coccinelle: use COPY_ARRAY for copying arrays").


Do you find the following code variant (for the semantic patch language) also useful?

 memcpy(
(       ptr, E, n *
-       sizeof(*(ptr))
+       sizeof(T)
|       arr, E, n *
-       sizeof(*(arr))
+       sizeof(T)
|       E, ptr, n *
-       sizeof(*(ptr))
+       sizeof(T)
|       E, arr, n *
-       sizeof(*(arr))
+       sizeof(T)
)
       )


How do you think about the following SmPL code variant?

-memcpy
+COPY_ARRAY
       (
(       dst_ptr
|       dst_arr
)
       ,
(       src_ptr
|       src_arr
)
       ,
-       (n) * sizeof(T)
+       n
       )


Regards,
Markus

```
