[vlc-commits] block_Realloc(): cast to block_sys_t after check

Rémi Denis-Courmont git at videolan.org
Mon Aug 29 17:41:18 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 29 18:05:30 2011 +0300| [03fe10796ca49944f55c2ae72f01f911ba5afadd] | committer: Rémi Denis-Courmont

block_Realloc(): cast to block_sys_t after check

There are no real functional changes Here. But it is cleaner not to
cast to block_sys_t if the block is not a block_sys_t block (i.e.
was not allocated by block_Alloc()).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=03fe10796ca49944f55c2ae72f01f911ba5afadd
---

 src/misc/block.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/misc/block.c b/src/misc/block.c
index 36fda91..a37e7fd 100644
--- a/src/misc/block.c
+++ b/src/misc/block.c
@@ -139,7 +139,6 @@ block_t *block_Alloc( size_t i_size )
 
 block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
 {
-    block_sys_t *p_sys = (block_sys_t *)p_block;
     size_t requested = i_prebody + i_body;
 
     /* Corner case: empty block requested */
@@ -159,9 +158,9 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
             return NULL;
 
         p_block = p_dup;
-        p_sys = (block_sys_t *)p_block;
     }
 
+    block_sys_t *p_sys = (block_sys_t *)p_block;
     uint8_t *p_start = p_sys->p_allocated_buffer;
     uint8_t *p_end = p_sys->p_allocated_buffer + p_sys->i_allocated_buffer;
 



More information about the vlc-commits mailing list