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

Re: [PATCH 1/1] imap-send: include strbuf.h

From
Junio C Hamano <gitster@pobox.com>
Date
May 17, 2023, 16:53 UTC
Message-ID
<xmqqcz2yrjbe.fsf@gitster.g>
In-Reply-To
<ZGT/eK6+IKlCM6Sg@nand.local>
Taylor Blau <me@ttaylorr.com> writes:
Show 10 quoted lines
> Here's the (gross) script I wrote up to check:
>
>     git grep -l -e '[^_]xstrdup(' -e 'strbuf_[a-z0-9A-Z_]*(' \*.c |
>     while read f
>     do
>         if ! gcc -I $(pwd) -E $f | grep -q 'struct strbuf {'
>         then
>             echo "==> $f NOT OK";
>         fi
>     done
I am a bit puzzled.

What does the above prove, more than what your regular compilation that does not fail, tells us? Doesn't -E expand recursively, so for the case of imap-send.c, with your usual configuration, wouldn't it have grabbed "struct strbuf" via inclusion of <http.h> indirectly anyway?

Show 24 quoted lines
> Here's the list:
>
>   ==> compat/fsmonitor/fsm-listen-darwin.c NOT OK
>   ==> compat/mingw.c NOT OK
>   ==> contrib/credential/osxkeychain/git-credential-osxkeychain.c NOT OK
>   ==> pager.c NOT OK
>   ==> refs/iterator.c NOT OK
>   ==> refs/ref-cache.c NOT OK
>   ==> string-list.c NOT OK
>   ==> t/helper/test-mktemp.c NOT OK
>
> The ones in compat are OK to ignore since they both fail to compile on
> my non-Windows machine (I am missing the `<dispatch/dispatch.h>` and
> `<windows.h>` headers, respectively).
>
> The one in contrib is fine to ignore, since it has its own definition of
> xstrdup().
>
> pager.c is OK, since it only needs xstrdup(), not any other parts of the
> strbuf API. It gets a declaration of xstrdup() from git-compat-util.h
> refs/iterator.c, refs/ref-cache.c, string-list.c, and
> t/helper/test-mktemp.c are all OK for the same reason.
>
> So I think that this is the only spot we need to worry about.
Previous: Taylor BlauNext: Junio C Hamano
Message 10 of 20 in “imap-send: include strbuf.h”
  1. 1/1 imap-send: include strbuf.hChristian Hesse, May 17, 2023
  2. Junio C HamanoMay 17, 2023
  3. Taylor BlauMay 17, 2023
  4. Junio C HamanoMay 17, 2023
  5. Taylor BlauMay 17, 2023
  6. Christian HesseMay 17, 2023
  7. Christian HesseMay 17, 2023
  8. Junio C HamanoMay 18, 2023
  9. Taylor BlauMay 17, 2023
  10. Junio C HamanoMay 17, 2023
  11. Junio C HamanoMay 17, 2023
  12. Taylor BlauMay 17, 2023
  13. rsbecker@nexbridge.comMay 17, 2023
  14. Junio C HamanoMay 17, 2023
  15. rsbecker@nexbridge.comMay 17, 2023
  16. Junio C HamanoMay 17, 2023
  17. Taylor BlauMay 17, 2023
  18. Junio C HamanoMay 18, 2023
  19. Jeff KingMay 18, 2023
  20. Junio C HamanoMay 18, 2023

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.