[vlc-devel] commit: directory: use block_heap_Alloc() ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Feb 14 11:46:44 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 14 12:46:25 2010 +0200| [6783cf4c8ecda3cb29f86306af2df1426b6cc910] | committer: Rémi Denis-Courmont
directory: use block_heap_Alloc()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6783cf4c8ecda3cb29f86306af2df1426b6cc910
---
modules/access/directory.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/modules/access/directory.c b/modules/access/directory.c
index a5562ce..aeb78b3 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -244,14 +244,12 @@ block_t *DirBlock (access_t *p_access)
"%s" \
" </extension>\n" \
"</playlist>\n", p_sys->psz_xspf_extension );
- if( len < 0 )
+ if (unlikely(len == -1))
goto fatal;
- block_t *block = block_Alloc ( len );
- if (!block)
- goto fatal;
- memcpy (block->p_buffer, footer, len);
- free( footer );
+ block_t *block = block_heap_Alloc (footer, footer, len);
+ if (unlikely(block == NULL))
+ free (footer);
p_access->info.b_eof = true;
return block;
}
@@ -393,15 +391,12 @@ block_t *DirBlock (access_t *p_access)
goto fatal;
free( old_xspf_extension );
- /* TODO: new block allocator for malloc()ated data */
- block_t *block = block_Alloc (len);
- if (!block)
+ block_t *block = block_heap_Alloc (entry, entry, len);
+ if (unlikely(block == NULL))
{
free (entry);
goto fatal;
}
- memcpy (block->p_buffer, entry, len);
- free (entry);
return block;
fatal:
More information about the vlc-devel
mailing list