From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TqqO2-00052n-K5 for mharc-grub-devel@gnu.org; Thu, 03 Jan 2013 14:23:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqqNz-00051g-0M for grub-devel@gnu.org; Thu, 03 Jan 2013 14:23:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqqNv-0007vh-3z for grub-devel@gnu.org; Thu, 03 Jan 2013 14:23:26 -0500 Received: from mail-ea0-f173.google.com ([209.85.215.173]:62743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqqNu-0007vY-Pq for grub-devel@gnu.org; Thu, 03 Jan 2013 14:23:23 -0500 Received: by mail-ea0-f173.google.com with SMTP id i13so6318874eaa.18 for ; Thu, 03 Jan 2013 11:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type; bh=MyF96FDmJjFRTpn0lNQPMO3I/VY9wH2wWFm1/+eBWGw=; b=PRwbCXMRu1OlT7qG/LUeGhWBOt1XghDjDaReVzmdiDZH+B5m99KMRYlrPFqWtqO9ey K+5b7yezQOJSJupEOjlmG6t9JzvNDmYdL9ej9Uw8aHFMTd7J7rT/nTr6RwoDGNxuRMKG 7h5w8/w1H/gSFhDcchbuu4P+sd12miADliOHEaEB5cVQFpZAwKRwrKEYLafxzFXOrovR h4EetyNCn4PM4JXwUE239iV/zd6MvdYcFaTEWVS2ErMWBZX74Am+pcqsUPuxEcByTMJp rowBQ0Xw+mVtNeZsSCiJF45pgsE9WUZMTjoQttefZ9TgIpEanDMP09FsgsWqhlKOKsLG epfQ== X-Received: by 10.14.1.195 with SMTP id 43mr136792390eed.31.1357241001995; Thu, 03 Jan 2013 11:23:21 -0800 (PST) Received: from debian.x201.phnet (54-133.79-83.cust.bluewin.ch. [83.79.133.54]) by mx.google.com with ESMTPS id v46sm105760095eep.1.2013.01.03.11.23.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Jan 2013 11:23:21 -0800 (PST) Message-ID: <50E5DAA7.6040801@gmail.com> Date: Thu, 03 Jan 2013 20:23:19 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: [PATCH] Remove unnecessary zero-initialisations from *io.c References: <20130101145852.GA21398@riva.dynamic.greenend.org.uk> In-Reply-To: <20130101145852.GA21398@riva.dynamic.greenend.org.uk> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigE0EC99A228A1CB35C68C014B" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.215.173 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2013 19:23:29 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE0EC99A228A1CB35C68C014B Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01.01.2013 15:58, Colin Watson wrote: > This patch removes explicit zero-initialisations from *io.c in favour o= f > grub_zalloc. Is there any good reason to initialise these explicitly? > This reduces the size of all four of these modules on i386-pc as > follows: >=20 > bufio -56 > gzio -24 > lzopio -20 > xzio -64 Go ahead. >=20 > 2013-01-01 Colin Watson >=20 > * grub-core/io/bufio.c (grub_bufio_open): Use grub_zalloc instead of > explicitly zeroing elements. > * grub-core/io/gzio.c (grub_gzio_open): Likewise. > * grub-core/io/lzopio.c (grub_lzopio_open): Remove explicit zeroing > of elements in a structure already allocated using grub_zalloc. > * grub-core/io/xzio.c (grub_xzio_open): Likewise. >=20 > =3D=3D=3D modified file 'grub-core/io/bufio.c' > --- grub-core/io/bufio.c 2011-12-25 14:43:15 +0000 > +++ grub-core/io/bufio.c 2013-01-01 14:38:07 +0000 > @@ -48,7 +48,7 @@ grub_bufio_open (grub_file_t io, int siz > grub_file_t file; > grub_bufio_t bufio =3D 0; > =20 > - file =3D (grub_file_t) grub_malloc (sizeof (*file)); > + file =3D (grub_file_t) grub_zalloc (sizeof (*file)); > if (! file) > return 0; > =20 > @@ -61,7 +61,7 @@ grub_bufio_open (grub_file_t io, int siz > size =3D ((io->size > GRUB_BUFIO_MAX_SIZE) ? GRUB_BUFIO_MAX_SIZE := > io->size); > =20 > - bufio =3D grub_malloc (sizeof (struct grub_bufio) + size); > + bufio =3D grub_zalloc (sizeof (struct grub_bufio) + size); > if (! bufio) > { > grub_free (file); > @@ -70,14 +70,10 @@ grub_bufio_open (grub_file_t io, int siz > =20 > bufio->file =3D io; > bufio->block_size =3D size; > - bufio->buffer_len =3D 0; > - bufio->buffer_at =3D 0; > =20 > file->device =3D io->device; > - file->offset =3D 0; > file->size =3D io->size; > file->data =3D bufio; > - file->read_hook =3D 0; > file->fs =3D &grub_bufio_fs; > file->not_easily_seekable =3D io->not_easily_seekable; > =20 >=20 > =3D=3D=3D modified file 'grub-core/io/gzio.c' > --- grub-core/io/gzio.c 2012-03-06 13:11:10 +0000 > +++ grub-core/io/gzio.c 2013-01-01 14:38:03 +0000 > @@ -1130,7 +1130,7 @@ grub_gzio_open (grub_file_t io) > grub_file_t file; > grub_gzio_t gzio =3D 0; > =20 > - file =3D (grub_file_t) grub_malloc (sizeof (*file)); > + file =3D (grub_file_t) grub_zalloc (sizeof (*file)); > if (! file) > return 0; > =20 > @@ -1144,9 +1144,7 @@ grub_gzio_open (grub_file_t io) > gzio->file =3D io; > =20 > file->device =3D io->device; > - file->offset =3D 0; > file->data =3D gzio; > - file->read_hook =3D 0; > file->fs =3D &grub_gzio_fs; > file->not_easily_seekable =3D 1; > =20 >=20 > =3D=3D=3D modified file 'grub-core/io/lzopio.c' > --- grub-core/io/lzopio.c 2012-04-07 17:54:51 +0000 > +++ grub-core/io/lzopio.c 2013-01-01 14:38:26 +0000 > @@ -428,9 +428,7 @@ grub_lzopio_open (grub_file_t io) > lzopio->file =3D io; > =20 > file->device =3D io->device; > - file->offset =3D 0; > file->data =3D lzopio; > - file->read_hook =3D 0; > file->fs =3D &grub_lzopio_fs; > file->size =3D GRUB_FILE_SIZE_UNKNOWN; > file->not_easily_seekable =3D 1; >=20 > =3D=3D=3D modified file 'grub-core/io/xzio.c' > --- grub-core/io/xzio.c 2012-02-12 14:25:25 +0000 > +++ grub-core/io/xzio.c 2013-01-01 14:39:38 +0000 > @@ -186,12 +186,9 @@ grub_xzio_open (grub_file_t io) > } > =20 > xzio->file =3D io; > - xzio->saved_offset =3D 0; > =20 > file->device =3D io->device; > - file->offset =3D 0; > file->data =3D xzio; > - file->read_hook =3D 0; > file->fs =3D &grub_xzio_fs; > file->size =3D GRUB_FILE_SIZE_UNKNOWN; > file->not_easily_seekable =3D 1; > @@ -210,10 +207,7 @@ grub_xzio_open (grub_file_t io) > } > =20 > xzio->buf.in =3D xzio->inbuf; > - xzio->buf.in_pos =3D 0; > - xzio->buf.in_size =3D 0; > xzio->buf.out =3D xzio->outbuf; > - xzio->buf.out_pos =3D 0; > xzio->buf.out_size =3D XZBUFSIZ; > =20 > /* FIXME: don't test footer on not easily seekable files. */ >=20 > Thanks, >=20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enigE0EC99A228A1CB35C68C014B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAlDl2qcACgkQNak7dOguQglbZAD/QI2EsfDsb9UbvMwjrW7pLinB MwrrCKSCHudVbRCTqWoA/0XpKyasvoA1m1fm0RtypxKgSrboVnha5C8eDzgIQIBF =ixGr -----END PGP SIGNATURE----- --------------enigE0EC99A228A1CB35C68C014B--