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

Re: [PATCH/RFC] Reduce parse-options.o dependencies

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jun 29, 2011, 20:29 UTC
Message-ID
<20110629202959.GJ22556@elie>
In-Reply-To
<1309000334-31980-1-git-send-email-divanorama@gmail.com>
Hi,
Dmitry Ivankov wrote:
> Currently parse-options.o pulls quite a big bunch
> of dependencies. This complicates it's usage in
> contrib/ because it pulls external dependencies
> and it also increases executables size.
Nitpick: it is easier to read text with a little longer lines;
typical for git.git is 70 columns or so.
> Split off less generic and more internal to git
> part of parse-options.c to parse-options-git.c.

These are just callbacks for special option types, right? Maybe something like parse-options-cb.c would make sense.

> Declare optbug and opterror as extern as they are
> shared between these parts and also may be used
> elsewhere.

I'd suggest making this a separate patch. The idea is that optbug and opterror might be used by option callbacks whether they are specific to a particular command or generic, so it is useful to expose them as a sort of toolkit for use with OPT_CALLBACK, right?

> Move prefix_function from setup.c to abspath.c.

I think you mean "prefix_filename". :) Makes sense --- prefix_filename is a generically useful function, not specific to git's filesystem layout.

> Now parse-options.o pulls just abspath.o, ctype.o,
> strbuf.o, usage.o, wrapper.o, libc directly and
> strlcpy.o indirectly.

One vague dream I've had is to submit strbuf and parse-options as CCAN modules (http://ccan.ozlabs.org/) in the hope that others will start to use them. The above should make that a little easier; thanks.

Show 10 quoted lines
> Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
> ---
>  Makefile            |    3 +-
>  abspath.c           |   28 +++++++++++++
>  parse-options-git.c |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  parse-options.c     |  108 +--------------------------------------------------
>  parse-options.h     |    3 +
>  setup.c             |   28 -------------
>  6 files changed, 143 insertions(+), 135 deletions(-)
>  create mode 100644 parse-options-git.c
[diff snipped, available at
 http://thread.gmane.org/gmane.comp.version-control.git/176318]
Previous: Dmitry IvankovNext: Dmitry Ivankov
Message 2 of 4 in “Reduce parse-options.o dependencies”
  1. Reduce parse-options.o dependenciesDmitry Ivankov, Jun 25, 2011
  2. Jonathan NiederJun 29, 2011
  3. 1/2 parse-options: export opterr, optbugDmitry Ivankov, Jul 3, 2011
  4. 2/2 Reduce parse-options.o dependenciesDmitry Ivankov, Jul 3, 2011

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.