]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/io/bufio.c (grub_bufio_open): Use grub_zalloc instead of
authorColin Watson <cjwatson@ubuntu.com>
Mon, 7 Jan 2013 10:45:05 +0000 (10:45 +0000)
committerColin Watson <cjwatson@ubuntu.com>
Mon, 7 Jan 2013 10:45:05 +0000 (10:45 +0000)
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.

ChangeLog
grub-core/io/bufio.c
grub-core/io/gzio.c
grub-core/io/lzopio.c
grub-core/io/xzio.c

index 097ef0de1095080406c9d7c6e07247a8eacc8427..75fb85a3c38a3e78a88cba31bd2010134dce118c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-01-07  Colin Watson  <cjwatson@ubuntu.com>
+
+       * 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.
+
 2013-01-07  Colin Watson  <cjwatson@ubuntu.com>
 
        * docs/grub.texi (grub_cpu): New subsection.
index 2a315e2d837d87061124d21043fe3ef90ef82ae2..22438277d7456358dfc6bcbb51317fd704987738 100644 (file)
@@ -48,7 +48,7 @@ grub_bufio_open (grub_file_t io, int size)
   grub_file_t file;
   grub_bufio_t bufio = 0;
 
-  file = (grub_file_t) grub_malloc (sizeof (*file));
+  file = (grub_file_t) grub_zalloc (sizeof (*file));
   if (! file)
     return 0;
 
@@ -61,7 +61,7 @@ grub_bufio_open (grub_file_t io, int size)
     size = ((io->size > GRUB_BUFIO_MAX_SIZE) ? GRUB_BUFIO_MAX_SIZE :
             io->size);
 
-  bufio = grub_malloc (sizeof (struct grub_bufio) + size);
+  bufio = grub_zalloc (sizeof (struct grub_bufio) + size);
   if (! bufio)
     {
       grub_free (file);
@@ -70,14 +70,10 @@ grub_bufio_open (grub_file_t io, int size)
 
   bufio->file = io;
   bufio->block_size = size;
-  bufio->buffer_len = 0;
-  bufio->buffer_at = 0;
 
   file->device = io->device;
-  file->offset = 0;
   file->size = io->size;
   file->data = bufio;
-  file->read_hook = 0;
   file->fs = &grub_bufio_fs;
   file->not_easily_seekable = io->not_easily_seekable;
 
index 83c0b64cb5bb8569c681dc7f9b06893226e7317c..59f2206a12bef485f8ff2a6cbe7ce67bcaacff92 100644 (file)
@@ -1130,7 +1130,7 @@ grub_gzio_open (grub_file_t io)
   grub_file_t file;
   grub_gzio_t gzio = 0;
 
-  file = (grub_file_t) grub_malloc (sizeof (*file));
+  file = (grub_file_t) grub_zalloc (sizeof (*file));
   if (! file)
     return 0;
 
@@ -1144,9 +1144,7 @@ grub_gzio_open (grub_file_t io)
   gzio->file = io;
 
   file->device = io->device;
-  file->offset = 0;
   file->data = gzio;
-  file->read_hook = 0;
   file->fs = &grub_gzio_fs;
   file->not_easily_seekable = 1;
 
index 77291d00188eabd9f579e9f914e7675dd0bc2347..7fdb6d4421459b9227bf257add11a6c7baaa4c6b 100644 (file)
@@ -428,9 +428,7 @@ grub_lzopio_open (grub_file_t io)
   lzopio->file = io;
 
   file->device = io->device;
-  file->offset = 0;
   file->data = lzopio;
-  file->read_hook = 0;
   file->fs = &grub_lzopio_fs;
   file->size = GRUB_FILE_SIZE_UNKNOWN;
   file->not_easily_seekable = 1;
index ae30e6f80182dbad0eedaef8d7e1f7b95df223dc..27657d83ecd523d688d4ee41a63b903c95e6f336 100644 (file)
@@ -186,12 +186,9 @@ grub_xzio_open (grub_file_t io)
     }
 
   xzio->file = io;
-  xzio->saved_offset = 0;
 
   file->device = io->device;
-  file->offset = 0;
   file->data = xzio;
-  file->read_hook = 0;
   file->fs = &grub_xzio_fs;
   file->size = GRUB_FILE_SIZE_UNKNOWN;
   file->not_easily_seekable = 1;
@@ -210,10 +207,7 @@ grub_xzio_open (grub_file_t io)
     }
 
   xzio->buf.in = xzio->inbuf;
-  xzio->buf.in_pos = 0;
-  xzio->buf.in_size = 0;
   xzio->buf.out = xzio->outbuf;
-  xzio->buf.out_pos = 0;
   xzio->buf.out_size = XZBUFSIZ;
 
   /* FIXME: don't test footer on not easily seekable files.  */