changeset 985:8cef771ff0fb

Minor optimization: no need to copy the whole remaining of the string, just copy next char.
author zas_
date Sat, 23 Aug 2008 20:46:31 +0000
parents bc73dc055cd0
children 533694a9675c
files src/exif-common.c
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/exif-common.c	Sat Aug 23 17:35:57 2008 +0000
+++ b/src/exif-common.c	Sat Aug 23 20:46:31 2008 +0000
@@ -154,19 +154,18 @@
 
 	if (software)
 		{
-		gint i;
+		gint i, j;
 
 		g_strstrip(software);
 		
 		/* remove superfluous spaces (pentax K100D) */
-		for (i = 0; software[i]; i++)
+		for (i = 0, j = 0; software[i]; i++, j++)
+			{
 			if (software[i] == ' ' && software[i + 1] == ' ')
-				{
-				gint j;
-
-				for (j = 1; software[i + j] == ' '; j++);
-				memmove(software + i + 1, software + i + j, strlen(software + i + j) + 1);
-				}
+				i++;
+			if (i != j) software[j] = software[i];
+			}
+		software[j] = '\0';
 		}
 
 	model2 = remove_common_prefix(make, model);