On Thu, Jun 21, 2018 at 09:03:05AM +0200, Johannes Schindelin wrote:
> > > And at that point, maybe
> > >
> > > char *some_var = xstrdup("default");
> > > git_config_string(&some_var, ...);
> > >
> > > that takes "char **" and frees the current storage before assigning to
> > > it may be sim
Hi Peff,
On Mon, 4 Jun 2018, Jeff King wrote:
> On Mon, Jun 04, 2018 at 01:26:57PM +0900, Junio C Hamano wrote:
>
> > And at that point, maybe
> >
> > char *some_var = xstrdup("default");
> > git_config_string(&some_var, ...);
> >
> > that takes "char **" and frees the current storage
On Sun, Jun 03, 2018 at 11:56:37PM -0400, Jeff King wrote:
> So sometimes some_var needs to be freed and sometimes not (and every one
> of those uses is a potential leak, but it's OK because they're all
> program-lifetime globals anyway, and people don't _tend_ to set the same
> option over and ov
Jeff King writes:
> With that strategy, we'd have to have a big initialize_defaults()
> function. Which actually might not be _too_ bad since we now have
> common-main.c, but:
>
> - it sucks to keep the default values far away from the declarations
>
> - it does carry a runtime cost. Not a hu
On Mon, Jun 04, 2018 at 01:26:57PM +0900, Junio C Hamano wrote:
> > Doing it "right" in C would probably involve two variables:
> >
> > const char *some_var = "default";
> > const char *some_var_storage = NULL;
> >
> > int git_config_string_smart(const char **ptr, char **storage,
> >
Jeff King writes:
> I've looked into it before, but that causes its own wave of headaches.
> The source of the problem is that we do:
>
> const char *some_var = "default";
> ...
> git_config_string(&some_var, ...);
Yup, that is a valid pattern for "run once and let exit(3) clean
after us"
On Mon, Jun 04, 2018 at 12:44:15PM +0900, Junio C Hamano wrote:
> >> diff --git a/sequencer.c b/sequencer.c
> >> index b98690ecd41..aba03e9429a 100644
> >> --- a/sequencer.c
> >> +++ b/sequencer.c
> >> @@ -175,6 +175,7 @@ static int git_sequencer_config(const char *k, const
> >> char *v, void *cb
Junio C Hamano writes:
> Stefan Beller writes:
>
>> Signed-off-by: Stefan Beller
>> ---
>> sequencer.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/sequencer.c b/sequencer.c
>> index b98690ecd41..aba03e9429a 100644
>> --- a/sequencer.c
>> +++ b/sequencer.c
>> @@ -175,6 +175,7 @@
Stefan Beller writes:
> Signed-off-by: Stefan Beller
> ---
> sequencer.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sequencer.c b/sequencer.c
> index b98690ecd41..aba03e9429a 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -175,6 +175,7 @@ static int git_sequencer_config(const
Signed-off-by: Stefan Beller
---
sequencer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sequencer.c b/sequencer.c
index b98690ecd41..aba03e9429a 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -175,6 +175,7 @@ static int git_sequencer_config(const char *k, const char
*v, void *cb)
10 matches
Mail list logo