changeset 25046:6f92f65d00e9

Move the zeroing directly before the other initialization code for the array/struct
author reimar
date Sat, 17 Nov 2007 18:49:33 +0000
parents f795ef502972
children e98388418c19
files stream/stream_dvd.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvd.c	Sat Nov 17 18:46:52 2007 +0000
+++ b/stream/stream_dvd.c	Sat Nov 17 18:49:33 2007 +0000
@@ -55,10 +55,7 @@
   struct sg_io_hdr sghdr;
   struct stat st;
 
-  memset(&sghdr, 0, sizeof(sghdr));
-  memset(buffer, 0, sizeof(buffer));
   memset(sense, 0, sizeof(sense));
-  memset(cmd, 0, sizeof(cmd));
   memset(&st, 0, sizeof(st));
 
   if (stat(device, &st) == -1) return;
@@ -80,6 +77,7 @@
     break;
   }
 
+  memset(&sghdr, 0, sizeof(sghdr));
   sghdr.interface_id = 'S';
   sghdr.timeout = 5000;
   sghdr.dxfer_direction = SG_DXFER_TO_DEV;
@@ -90,9 +88,11 @@
   sghdr.dxferp = buffer;
   sghdr.cmdp = cmd;
 
+  memset(cmd, 0, sizeof(cmd));
   cmd[0] = GPCMD_SET_STREAMING;
   cmd[10] = sizeof(buffer);
 
+  memset(buffer, 0, sizeof(buffer));
   /* first sector 0, last sector 0xffffffff */
   AV_WB32(buffer + 8, 0xffffffff);