threads / patch / 16318

patchrevision.c: use proper data type in call to sizeof() within xrealloc

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

## tl;dr

2 messages between Nov 13, 2008 and Nov 14, 2008. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Brandon Casey· Nov 13, 2008, 20:20 UTC · lore

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(-)
Show changes to revision.c +1 −1
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· Nov 14, 2008, 06:24 UTC · re: Brandon Casey · lore

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

On Thu, Nov 13, 2008 at 02:20:37PM -0600, Brandon Casey wrote:
Show 5 quoted lines
>  	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

← back to recent threads