[PATCH] Replace loop by memset in sal/typesconfig/typesconfig.c

julien2412 serval2412 at yahoo.fr
Mon Dec 24 06:45:52 PST 2012


Hello,

By taking a look at the file  sal/typesconfig/typesconfig.c, GetAlignment
function, I wonder if we could replace the for loop by a memset to optimize
a bit. 
So here's a straightforward patch:
diff --git a/sal/typesconfig/typesconfig.c b/sal/typesconfig/typesconfig.c
index 473f07a..ef52c5f 100644
--- a/sal/typesconfig/typesconfig.c
+++ b/sal/typesconfig/typesconfig.c
@@ -262,11 +262,9 @@ int GetAlignment( Type eT )
 {
   char  a[ 16*8 ];
   long  p = (long)(void*)a;
-  int   i;
 
   /* clear a[...] to set legal value for double access */
-  for ( i = 0; i < 16*8; i++ )
-    a[i] = 0;
+  memset(a, 0, sizeof(a));
 
   p = ( p + 0xF ) & ~0xF;
   for ( i = 1; i < 16; i++ )

Would it be ok?

Julien




--
View this message in context: http://nabble.documentfoundation.org/PATCH-Replace-loop-by-memset-in-sal-typesconfig-typesconfig-c-tp4026017.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list