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

[PATCH 0/2] string_list API users: use alloc + init, not calloc + strdup_strings

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 21, 2022, 06:39 UTC
Message-ID
<cover-0.2-00000000000-20220721T063543Z-avarab@gmail.com>

As a small follow-up to Junio's https://lore.kernel.org/git/xmqq7d471dns.fsf@gitster.g/; This is a small set of fixes to use the string_list functions rather than peeking into its guts during initalization.

I've been running my local git version with these changes for almost a year, but for submision I wrote a coccinelle rule to cover most of it in 1/2, along with a tests using the new recently landed coccicheck test support.

The 2/2 is then things I had to manually change still, which weren't covered by the conservative rule.

Ævar Arnfjörð Bjarmason (2):
  string_list API users + cocci: use string_list_init_dup()
  string-list API users: manually use string_list_init_*()
 contrib/coccinelle/string_list.cocci     | 8 ++++++++
 contrib/coccinelle/tests/string_list.c   | 7 +++++++
 contrib/coccinelle/tests/string_list.res | 7 +++++++
 notes-utils.c                            | 4 ++--
 reflog-walk.c                            | 2 +-
 refs.c                                   | 4 ++--
 resolve-undo.c                           | 8 ++++----
 revision.c                               | 4 ++--
 8 files changed, 33 insertions(+), 11 deletions(-)
 create mode 100644 contrib/coccinelle/string_list.cocci
 create mode 100644 contrib/coccinelle/tests/string_list.c
 create mode 100644 contrib/coccinelle/tests/string_list.res
-- 
2.37.1.1095.g64a1e8362fd
Next: Ævar Arnfjörð Bjarmason
Message 1 of 11 in “string_list API users: use alloc + init, not calloc + strdup_strings”
  1. 0/2 string_list API users: use alloc + init, not calloc + strdup_stringsÆvar Arnfjörð Bjarmason, Jul 21, 2022
  2. 1/2 string_list API users + cocci: use string_list_init_dup()Ævar Arnfjörð Bjarmason, Jul 21, 2022
  3. 2/2 string-list API users: manually use string_list_init_*()Ævar Arnfjörð Bjarmason, Jul 21, 2022
  4. Elijah NewrenJul 21, 2022
  5. 0/6 string-list API user: fix API use, some with coccinelleÆvar Arnfjörð Bjarmason, Jul 21, 2022
  6. 1/6 string_list API users + cocci: use string_list_init_dup()Ævar Arnfjörð Bjarmason, Jul 21, 2022
  7. 2/6 cocci: apply string_list.cocci with --disable-worth-trying-optÆvar Arnfjörð Bjarmason, Jul 21, 2022
  8. 3/6 reflog-walk.c: use string_list_init_dup()Ævar Arnfjörð Bjarmason, Jul 21, 2022
  9. 5/6 string-list API users: don't tweak "strdup_strings" to free dupesÆvar Arnfjörð Bjarmason, Jul 21, 2022
  10. 4/6 cocci: add "string_list" rule to swap "DUP" <-> "NODUP"Ævar Arnfjörð Bjarmason, Jul 21, 2022
  11. 6/6 notes.c: make "struct string_list display_notes_refs" non-staticÆvar Arnfjörð Bjarmason, Jul 21, 2022

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.