[Kst] extragear/graphics/kst/kst/datasources/dirfile

George Staikos staikos at kde.org
Tue Oct 11 05:59:49 CEST 2005


SVN commit 469412 by staikos:

some minor speedups


 M  +11 -11    getdata.c  


--- trunk/extragear/graphics/kst/kst/datasources/dirfile/getdata.c #469411:469412
@@ -63,24 +63,24 @@
   int i, len;
 
   do {
-    ret_val=fgets(line, MAX_LINE_LENGTH, fp);
-    first_char=0;
-    while ((line[first_char]==' ') || (line[first_char]=='\t')) first_char++;
+    ret_val = fgets(line, MAX_LINE_LENGTH, fp);
+    first_char = 0;
+    while (line[first_char] == ' ' || line[first_char] == '\t') ++first_char;
     line += first_char;
-  } while (((line[0] =='#') || (strlen(line)<2)) && (ret_val!=NULL));
+  } while (ret_val && (line[0] == '#' || line[0] == 0 || line[1] == 0));
 
 
-  if (ret_val!=NULL) {
+  if (ret_val) {
     /* truncate comments from end of lines */
     len = strlen(line);
-    for (i=0; i<len; i++) {
-      if (line[i]=='#') line[i] = '\0';
+    for (i = 0; i < len; i++) {
+      if (line[i]=='#')
+        line[i] = '\0';
     }
 
-    return (1); /* a line was read */
-  } else {
-    return(0);  /* there were no valid lines */
+    return(1); /* a line was read */
   }
+  return(0);  /* there were no valid lines */
 }
 
 
@@ -90,7 +90,7 @@
 /*                                                                         */
 /***************************************************************************/
 static void FreeF(struct FormatType *F) {
-  if (F->n_raw>0) free(F->rawEntries);
+  if (F->n_raw > 0) free(F->rawEntries);
   if (F->n_lincom > 0) free(F->lincomEntries);
   if (F->n_multiply > 0) free(F->multiplyEntries);
   if (F->n_linterp >0) free(F->linterpEntries);


More information about the Kst mailing list