142 lines
4.2 KiB
Diff
142 lines
4.2 KiB
Diff
|
From c86f86069fd8d600ebc4ffbd8a786c58fccff886 Mon Sep 17 00:00:00 2001
|
||
|
From: Colin Watson <cjwatson@ubuntu.com>
|
||
|
Date: Mon, 7 Jan 2013 10:45:05 +0000
|
||
|
Subject: [PATCH 090/364] * 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.
|
||
|
|
||
|
---
|
||
|
ChangeLog | 9 +++++++++
|
||
|
grub-core/io/bufio.c | 8 ++------
|
||
|
grub-core/io/gzio.c | 4 +---
|
||
|
grub-core/io/lzopio.c | 2 --
|
||
|
grub-core/io/xzio.c | 6 ------
|
||
|
5 files changed, 12 insertions(+), 17 deletions(-)
|
||
|
|
||
|
diff --git a/ChangeLog b/ChangeLog
|
||
|
index 097ef0d..75fb85a 100644
|
||
|
--- a/ChangeLog
|
||
|
+++ b/ChangeLog
|
||
|
@@ -1,5 +1,14 @@
|
||
|
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.
|
||
|
(grub_platform): Likewise.
|
||
|
|
||
|
diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c
|
||
|
index 2a315e2..2243827 100644
|
||
|
--- a/grub-core/io/bufio.c
|
||
|
+++ b/grub-core/io/bufio.c
|
||
|
@@ -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;
|
||
|
|
||
|
diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c
|
||
|
index 83c0b64..59f2206 100644
|
||
|
--- a/grub-core/io/gzio.c
|
||
|
+++ b/grub-core/io/gzio.c
|
||
|
@@ -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;
|
||
|
|
||
|
diff --git a/grub-core/io/lzopio.c b/grub-core/io/lzopio.c
|
||
|
index 77291d0..7fdb6d4 100644
|
||
|
--- a/grub-core/io/lzopio.c
|
||
|
+++ b/grub-core/io/lzopio.c
|
||
|
@@ -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;
|
||
|
diff --git a/grub-core/io/xzio.c b/grub-core/io/xzio.c
|
||
|
index ae30e6f..27657d8 100644
|
||
|
--- a/grub-core/io/xzio.c
|
||
|
+++ b/grub-core/io/xzio.c
|
||
|
@@ -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. */
|
||
|
--
|
||
|
1.8.1.4
|
||
|
|