Re: [ANNOUNCE] GIT 1.5.4-rc3

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

 



Hi,

On Sat, 12 Jan 2008, Jeff King wrote:

> diff --git a/builtin-clean.c b/builtin-clean.c
> index 6cad8ea..eb853a3 100644
> --- a/builtin-clean.c
> +++ b/builtin-clean.c
> @@ -90,7 +90,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
>  	strbuf_init(&directory, 0);
>  
>  	if (pathspec)
> -		seen = xmalloc(argc);
> +		seen = xmalloc(argc > 0 ? argc : 1);
>  
>  	for (i = 0; i < dir.nr; i++) {
>  		struct dir_entry *ent = dir.entries[i];
> @@ -125,7 +125,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
>  			continue;
>  
>  		if (pathspec) {
> -			memset(seen, 0, argc);
> +			memset(seen, 0, argc > 0 ? argc : 1);
>  			matches = match_pathspec(pathspec, ent->name, ent->len,
>  						 baselen, seen);
>  		} else {

Would it not be better to guard the memset by an "if (argc)", and set 
"seen" to NULL by default?

Ciao,
Dscho

-
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