git/list[1] front-page[2] threads[3] people[4] search[5] about
 

coccinelle: adjustments for array.cocci?

From
MEMarkus Elfring <markus.elfring@web.de>
Date
Nov 12, 2019, 15:08 UTC
Message-ID
<c978fed2-6a89-b6da-7664-9bf8c8cd5b84@web.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

Message 1 of 1 in “coccinelle: adjustments for array.cocci?”
  1. Markus ElfringNov 12, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.