[vlc-commits] ts mux: simplify compare functions
Rafaël Carré
git at videolan.org
Fri Feb 10 02:03:12 CET 2012
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Thu Feb 9 19:50:29 2012 -0500| [110d75c376f56093340745af3046f99c4d90c99c] | committer: Rafaël Carré
ts mux: simplify compare functions
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=110d75c376f56093340745af3046f99c4d90c99c
---
modules/mux/mpeg/ts.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index 98d5f24..2455f4d 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -444,22 +444,15 @@ static int AllocatePID( sout_mux_sys_t *p_sys, int i_cat )
static int pmtcompare( const void *pa, const void *pb )
{
- if ( ((pmt_map_t *)pa)->i_pid < ((pmt_map_t *)pb)->i_pid )
- return -1;
- else if ( ((pmt_map_t *)pa)->i_pid > ((pmt_map_t *)pb)->i_pid )
- return 1;
- else
- return 0;
+ int id1 = ((pmt_map_t *)pa)->i_pid;
+ int id2 = ((pmt_map_t *)pb)->i_pid;
+
+ return id1 - id2;
}
static int intcompare( const void *pa, const void *pb )
{
- if ( *(int *)pa < *(int *)pb )
- return -1;
- else if ( *(int *)pa > *(int *)pb )
- return 1;
- else
- return 0;
+ return *(int*)pa - *(int*)pb;
}
/*****************************************************************************
@@ -566,7 +559,7 @@ static int Open( vlc_object_t *p_this )
/* Now sort according to pids for fast search later on */
qsort( (void *)p_sys->pmtmap, p_sys->i_pmtslots,
- sizeof(pmt_map_t), &pmtcompare );
+ sizeof(pmt_map_t), pmtcompare );
if ( !*psz_next )
psz = NULL;
}
More information about the vlc-commits
mailing list