[vlc-commits] Alias vlc_memset() to memset()

Rémi Denis-Courmont git at videolan.org
Tue May 10 17:26:25 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue May 10 18:10:27 2011 +0300| [6a45dac72f9ba86bfeea29be255bfdee7f74fb6e] | committer: Rémi Denis-Courmont

Alias vlc_memset() to memset()

This saves two function calls per memset() since there are no optimized
implementations of memset() at all.

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

 include/vlc_common.h     |    2 +-
 include/vlc_cpu.h        |    3 +--
 modules/3dnow/memcpy.c   |    2 +-
 modules/altivec/memcpy.c |    2 +-
 modules/mmx/memcpy.c     |    2 +-
 modules/mmxext/memcpy.c  |    2 +-
 src/libvlccore.sym       |    1 -
 src/misc/cpu.c           |   17 +++--------------
 8 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 3b94469..b66a63f 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -839,7 +839,7 @@ VLC_API void vlc_tdestroy( void *, void (*)(void *) );
 
 /* Fast large memory copy and memory set */
 VLC_API void * vlc_memcpy( void *, const void *, size_t );
-VLC_API void * vlc_memset( void *, int, size_t );
+#define vlc_memset memset
 
 /*****************************************************************************
  * I18n stuff
diff --git a/include/vlc_cpu.h b/include/vlc_cpu.h
index 934fa1e..674e78e 100644
--- a/include/vlc_cpu.h
+++ b/include/vlc_cpu.h
@@ -86,9 +86,8 @@ VLC_API unsigned vlc_GetCPUCount( void );
 # endif
 
 typedef void *(*vlc_memcpy_t) (void *tgt, const void *src, size_t n);
-typedef void *(*vlc_memset_t) (void *tgt, int c, size_t n);
 
-VLC_API void vlc_fastmem_register(vlc_memcpy_t cpy, vlc_memset_t set);
+VLC_API void vlc_fastmem_register(vlc_memcpy_t cpy);
 
 #endif /* !VLC_CPU_H */
 
diff --git a/modules/3dnow/memcpy.c b/modules/3dnow/memcpy.c
index 34b1f87..9034d6f 100644
--- a/modules/3dnow/memcpy.c
+++ b/modules/3dnow/memcpy.c
@@ -38,7 +38,7 @@ static int Activate( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     VLC_UNUSED(p_this);
-    vlc_fastmem_register( fast_memcpy, NULL );
+    vlc_fastmem_register( fast_memcpy );
 
     return VLC_SUCCESS;
 }
diff --git a/modules/altivec/memcpy.c b/modules/altivec/memcpy.c
index cd329c1..071e91e 100644
--- a/modules/altivec/memcpy.c
+++ b/modules/altivec/memcpy.c
@@ -53,7 +53,7 @@ static int Activate ( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     VLC_UNUSED(p_this);
-    vlc_fastmem_register( fast_memcpy, NULL );
+    vlc_fastmem_register( fast_memcpy );
     return VLC_SUCCESS;
 }
 
diff --git a/modules/mmx/memcpy.c b/modules/mmx/memcpy.c
index 8aa55ac..d507968 100644
--- a/modules/mmx/memcpy.c
+++ b/modules/mmx/memcpy.c
@@ -38,7 +38,7 @@ static int Activate( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     VLC_UNUSED(p_this);
-    vlc_fastmem_register( fast_memcpy, NULL );
+    vlc_fastmem_register( fast_memcpy );
 
     return VLC_SUCCESS;
 }
diff --git a/modules/mmxext/memcpy.c b/modules/mmxext/memcpy.c
index 344bff7..5ddca2e 100644
--- a/modules/mmxext/memcpy.c
+++ b/modules/mmxext/memcpy.c
@@ -38,7 +38,7 @@ static int Activate( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     VLC_UNUSED(p_this);
-    vlc_fastmem_register( fast_memcpy, NULL );
+    vlc_fastmem_register( fast_memcpy );
 
     return VLC_SUCCESS;
 }
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 2f2602a..8961537 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -557,7 +557,6 @@ vlc_join
 vlc_list_children
 vlc_list_release
 vlc_memcpy
-vlc_memset
 vlc_memalign
 vlc_meta_AddExtra
 vlc_meta_CopyExtraNames
diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index f40654a..6f5d8fb 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -385,14 +385,11 @@ unsigned vlc_GetCPUCount(void)
 }
 
 static vlc_memcpy_t pf_vlc_memcpy = memcpy;
-static vlc_memset_t pf_vlc_memset = memset;
 
-void vlc_fastmem_register (vlc_memcpy_t cpy, vlc_memset_t set)
+void vlc_fastmem_register (vlc_memcpy_t cpy)
 {
-    if (cpy)
-        pf_vlc_memcpy = cpy;
-    if (set)
-        pf_vlc_memset = set;
+    assert (cpy != NULL);
+    pf_vlc_memcpy = cpy;
 }
 
 /**
@@ -404,14 +401,6 @@ void *vlc_memcpy (void *tgt, const void *src, size_t n)
 }
 
 /**
- * vlc_memset: fast CPU-dependent memset
- */
-void *vlc_memset (void *tgt, int c, size_t n)
-{
-    return pf_vlc_memset (tgt, c, n);
-}
-
-/**
  * Returned an aligned pointer on newly allocated memory.
  * \param alignment must be a power of 2 and a multiple of sizeof(void*)
  * \param size is the size of the usable memory returned.



More information about the vlc-commits mailing list