[Kst] kdeextragear-2/kst/kst/datasources/dirfile

Barth Netterfield netterfield at astro.utoronto.ca
Wed Nov 3 15:20:28 CET 2004


CVS commit by netterfield: 

Use memset rather than looping to zero float and double arrays.


  M +5 -5      getdata.c   1.20


--- kdeextragear-2/kst/kst/datasources/dirfile/getdata.c  #1.19:1.20
@@ -665,5 +665,5 @@ static int ConvertType(unsigned char *da
 /***************************************************************************/
 static int FillZero(char *databuffer, char type, int s0, int ns) {
-  int nz, i;
+  int nz;
 
   if (s0>=0) return 0;
@@ -686,8 +686,8 @@ static int FillZero(char *databuffer, ch
       break;
   case 'f':
-    for (i=0;i<nz;i++) ((float*)databuffer)[i]=0.0;
+    memset(databuffer, 0, nz*sizeof(float));
     break;
   case 'd':
-    for (i=0;i<nz;i++) ((double*)databuffer)[i]=0.0;
+    memset(databuffer, 0, nz*sizeof(double));    
     break;
   }





More information about the Kst mailing list