[easytag] Small optimization for scanner functions



commit 476068994d89ee939e89e296a13884d642830fc8
Author: Abhinav <abhijangda hotmail com>
Date:   Thu Apr 3 22:25:15 2014 +0100

    Small optimization for scanner functions
    
    Discovered while fixing bug 726108.

 src/scan.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/scan.c b/src/scan.c
index e2476aa..a926ddc 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -1716,12 +1716,15 @@ void Scan_Process_Fields_Keep_One_Space (gchar *string)
  * Function to replace underscore '_' by a space
  * No need to reallocate
  */
-void Scan_Convert_Underscore_Into_Space (gchar *string)
+void
+Scan_Convert_Underscore_Into_Space (gchar *string)
 {
-    gchar *tmp;
+    gchar *tmp = string;
 
-    while ((tmp=strchr(string,'_'))!=NULL)
+    while ((tmp = strchr (tmp, '_')) != NULL)
+    {
         *tmp = ' ';
+    }
 }
 
 /*
@@ -1770,10 +1773,12 @@ void Scan_Remove_Spaces (gchar *string)
  */
 void Scan_Convert_Space_Into_Undescore (gchar *string)
 {
-    gchar *tmp;
+    gchar *tmp = string;
 
-    while ((tmp=strchr(string,' '))!=NULL)
+    while ((tmp = strchr (tmp, ' ')) != NULL)
+    {
         *tmp = '_';
+    }
 }
 
 /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]