Re: [Janitors] value could be NULL in config parser

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

 



On 2/8/08, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> A callback function of git_config() is called when the command
> reads value from .git/config and friends.  The function takes
> two parameters, var and value.  var is never NULL and it is the
> name of the configuration variable found in the file being
> read.  value could be either string or NULL.
>
> A NULL value is boolean "true".  For example, on MS-DOS, you may
> have something like this:
>
>         [core]
>                 autocrlf
>
> and your callback will be called with var = "core.autocrlf" and
> value = NULL in such a case.
>
> If you want to fix them (you do not have to do all of them, and
> if you would like to help, please make one patch per function
> fixed), the procedure is:
>

I think I got all the erroneous ones.  I did

find . -name "*.c" | xargs grep git_config\( | awk '{ idx = index($2,
")"); p = substr($2, 12, idx - 12); print  p }' | sort | uniq -u

To try and get a list of all the ones that might need updating.  I did
notice that most functions never check value for null, but they don't
directly access them.  They pass them off to other methods.  As far as
I can tell, some of these methods don't validate the NULL.  So they
will need to be updated.

Question.  Wouldn't it reduce the amount of validation we have to do
if whoever is calling back checked null and assigned an empty string?
If so, we can probably replace all these patches with one patch.

-Govind
-
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]

  Powered by Linux