Replace "sizeof(struct bucket[cache_size])" with

"cache_size * sizeof(struct bucket)".  The former is valid in C99 but can
confuse earlier compilers, while the latter is a standard idiom which all
C compilers understand.

Approved by:	kientzle
This commit is contained in:
Colin Percival 2007-05-22 15:37:58 +00:00
parent 6200d44319
commit a30eadfc15

View File

@ -100,10 +100,10 @@ static void cleanup(void *);
int
archive_write_disk_set_standard_lookup(struct archive *a)
{
struct bucket *ucache = malloc(sizeof(struct bucket[cache_size]));
struct bucket *gcache = malloc(sizeof(struct bucket[cache_size]));
memset(ucache, 0, sizeof(struct bucket[cache_size]));
memset(gcache, 0, sizeof(struct bucket[cache_size]));
struct bucket *ucache = malloc(cache_size * sizeof(struct bucket));
struct bucket *gcache = malloc(cache_size * sizeof(struct bucket));
memset(ucache, 0, cache_size * sizeof(struct bucket));
memset(gcache, 0, cache_size * sizeof(struct bucket));
archive_write_disk_set_group_lookup(a, gcache, lookup_gid, cleanup);
archive_write_disk_set_user_lookup(a, ucache, lookup_uid, cleanup);
return (ARCHIVE_OK);