Re: [PATCH 1/7] path.c: implement xdg_config_home()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 14, 2015 at 1:39 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Johannes Schindelin <johannes.schindelin@xxxxxx> writes:
>
>>> diff --git a/cache.h b/cache.h
>>> index 3d3244b..7f9bab0 100644
>>> --- a/cache.h
>>> +++ b/cache.h
>>> @@ -836,6 +836,13 @@ char *strip_path_suffix(const char *path, const
>>> char *suffix);
>>>  int daemon_avoid_alias(const char *path);
>>>  extern int is_ntfs_dotgit(const char *name);
>>>
>>> +/**
>>> + * Returns the newly allocated string "$XDG_CONFIG_HOME/git/%s".  If
>>> + * $XDG_CONFIG_HOME is unset or empty, returns the newly allocated string
>>> + * "$HOME/.config/git/%s". Returns NULL if an error occurred.
>>> + */
>>> +extern char *xdg_config_home(const char *fn);
>>
>> Should this not be inserted close to home_config_paths()? Also, the
>> name "fn" sounds more like "function" than like "filename" to me,
>> especially keeping the name `config_fn_t` in mind. Maybe call the
>> parameter "filename" to avoid confusion?
>
> It is OK to omit the name in the extern declaration here.  We have
> to have a sensible variable name in the definition in path.c, of
> course ;-), and "filename" sounds like a very sensible suggestion.
>

It is OK, but I think this is bad practice.
Have a look at strbuf.h, there you'll find:

    extern int strbuf_getwholeline_fd(struct strbuf *, int, int);

It's not clear what the 2 ints are, probably a fd and a max size?
Even if guessed correctly, you'd still need another guess for the order.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]