# [PATCH] revision.c: use proper data type in call to sizeof() within xrealloc

2 messages from 2008-11-13 to 2008-11-14. Participants: Brandon Casey, Jeff King.
Thread: https://gitlist.dev/t/16318

## Brandon Casey, 2008-11-13 20:20

Subject: [PATCH] revision.c: use proper data type in call to sizeof() within xrealloc
Message-ID: <2NXgsahhUCpkej6JukLNJjebzyoAQgZ4ptQMMrR2j_iWS5yEqKYn0kxHsUBpiY6bkpfbTjxlSn0@cipher.nrlssc.navy.mil>
URL: https://gitlist.dev/e/2NXgsahhUCpkej6JukLNJjebzyoAQgZ4ptQMMrR2j_iWS5yEqKYn0kxHsUBpiY6bkpfbTjxlSn0%40cipher.nrlssc.navy.mil

```
A type char** was being used instead of char*.
---


Just a little typo, that doesn't make any difference but should be fixed.

-brandon


 revision.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/revision.c b/revision.c
index 2f646de..440d152 100644
--- a/revision.c
+++ b/revision.c
@@ -968,7 +968,7 @@ static void add_ignore_packed(struct rev_info *revs, const char *name)
 	int num = ++revs->num_ignore_packed;
 
 	revs->ignore_packed = xrealloc(revs->ignore_packed,
-				       sizeof(const char **) * (num + 1));
+				       sizeof(const char *) * (num + 1));
 	revs->ignore_packed[num-1] = name;
 	revs->ignore_packed[num] = NULL;
 }
-- 
1.6.0.3.552.g12334

```

## Jeff King, 2008-11-14 06:24

Subject: Re: [PATCH] revision.c: use proper data type in call to sizeof() within xrealloc
Message-ID: <20081114062434.GA11907@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20081114062434.GA11907%40coredump.intra.peff.net
In-Reply-To: <2NXgsahhUCpkej6JukLNJjebzyoAQgZ4ptQMMrR2j_iWS5yEqKYn0kxHsUBpiY6bkpfbTjxlSn0@cipher.nrlssc.navy.mil>

```
On Thu, Nov 13, 2008 at 02:20:37PM -0600, Brandon Casey wrote:

>  	int num = ++revs->num_ignore_packed;
>  
>  	revs->ignore_packed = xrealloc(revs->ignore_packed,
> -				       sizeof(const char **) * (num + 1));
> +				       sizeof(const char *) * (num + 1));

Maybe it would be even nicer as "sizeof(*revs->ignore_packed)"?

-Peff

```
