From 76d156766fc9364ed2ce1b07f0867cbbdc5932f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 15 Sep 2016 20:30:52 +0200 Subject: contrib/coccinelle: fix semantic patch for oid_to_hex_r() Both sha1_to_hex_r() and oid_to_hex_r() take two parameters, so use two expressions in the semantic patch for transforming calls of the former to the latter one. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- contrib/coccinelle/object_id.cocci | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'contrib') diff --git a/contrib/coccinelle/object_id.cocci b/contrib/coccinelle/object_id.cocci index 8ccdbb566..0307624a0 100644 --- a/contrib/coccinelle/object_id.cocci +++ b/contrib/coccinelle/object_id.cocci @@ -23,16 +23,16 @@ expression E1; + oid_to_hex(E1) @@ -expression E1; +expression E1, E2; @@ -- sha1_to_hex_r(E1.hash) -+ oid_to_hex_r(&E1) +- sha1_to_hex_r(E1, E2.hash) ++ oid_to_hex_r(E1, &E2) @@ -expression E1; +expression E1, E2; @@ -- sha1_to_hex_r(E1->hash) -+ oid_to_hex_r(E1) +- sha1_to_hex_r(E1, E2->hash) ++ oid_to_hex_r(E1, E2) @@ expression E1; -- cgit v1.2.1 From a22ae753cb297cb8a1e3ae950ae4415190cd51d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 15 Sep 2016 20:31:00 +0200 Subject: use strbuf_addstr() for adding constant strings to a strbuf, part 2 Replace uses of strbuf_addf() for adding strings with more lightweight strbuf_addstr() calls. This makes the intent clearer and avoids potential issues with printf format specifiers. 02962d36845b89145cd69f8bc65e015d78ae3434 already converted six cases, this patch covers eleven more. A semantic patch for Coccinelle is included for easier checking for new cases that might be introduced in the future. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- contrib/coccinelle/strbuf.cocci | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 contrib/coccinelle/strbuf.cocci (limited to 'contrib') diff --git a/contrib/coccinelle/strbuf.cocci b/contrib/coccinelle/strbuf.cocci new file mode 100644 index 000000000..7932d48cd --- /dev/null +++ b/contrib/coccinelle/strbuf.cocci @@ -0,0 +1,5 @@ +@@ +expression E1, E2; +@@ +- strbuf_addf(E1, E2); ++ strbuf_addstr(E1, E2); -- cgit v1.2.1