[CalendarServer-changes] [1769] CalendarServer/trunk/twistedcaldav/admin/logs.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 8 09:10:01 PDT 2007


Revision: 1769
          http://trac.macosforge.org/projects/calendarserver/changeset/1769
Author:   cdaboo at apple.com
Date:     2007-08-08 09:10:01 -0700 (Wed, 08 Aug 2007)

Log Message:
-----------
10% faster.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/admin/logs.py

Modified: CalendarServer/trunk/twistedcaldav/admin/logs.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/logs.py	2007-08-08 15:24:15 UTC (rev 1768)
+++ CalendarServer/trunk/twistedcaldav/admin/logs.py	2007-08-08 16:10:01 UTC (rev 1769)
@@ -208,37 +208,38 @@
     state = NORMAL
     elements = []
     
-    rest = []
+    rest = ""
 
     for c in line:
-        if c == ' ':
-            if state == NORMAL:
-                elements.append(''.join(rest))
-                rest = []
-
-            elif state == INSTRING or state == INDATE:
-                rest.append(c)
-                    
-        elif c == '[':
-            if state != INSTRING:
-                state = INDATE
+        if c in (' ', '[', ']', '"', '\n'):
+            if c == ' ':
+                if state == NORMAL:
+                    elements.append(rest)
+                    rest = ""
+    
+                elif state == INSTRING or state == INDATE:
+                    rest += c
                         
-        elif c == ']':
-            if state == INDATE:
-                state = NORMAL
+            elif c == '[':
+                if state != INSTRING:
+                    state = INDATE
+                            
+            elif c == ']':
+                if state == INDATE:
+                    state = NORMAL
+    
+            elif c == '"':
+                if state == INSTRING:
+                    state = NORMAL
+                else:
+                    state = INSTRING
+            elif c == '\n':
+                if state == NORMAL:
+                    elements.append(rest)
+                    rest = ""
 
-        elif c == '"':
-            if state == INSTRING:
-                state = NORMAL
-            else:
-                state = INSTRING
-        elif c == '\n':
-            if state == NORMAL:
-                elements.append(''.join(rest))
-                rest = []
-
         else:
-            rest.append(c)
+            rest += c
 
     return elements
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070808/e4b6d4c2/attachment.html


More information about the calendarserver-changes mailing list