浏览代码

* Small optimization for comparing nil strings.

git-svn-id: trunk@35619 -
michael 8 年之前
父节点
当前提交
2714a06e77
共有 1 个文件被更改,包括 3 次插入14 次删除
  1. 3 14
      rtl/inc/astrings.inc

+ 3 - 14
rtl/inc/astrings.inc

@@ -719,21 +719,10 @@ Var
   cp1,cp2 : TSystemCodePage;
 begin
   if pointer(S1)=pointer(S2) then
-    begin
-      result:=0;
-      exit;
-    end;
+    Exit(0);
   { don't compare strings if one of them is empty }
-  if (pointer(S1)=nil) then
-    begin
-      result:=-1;
-      exit;
-    end;
-  if (pointer(S2)=nil) then
-    begin
-      result:=1;
-      exit;
-    end;
+  if (pointer(S1)=nil) or (pointer(S2)=Nil) then
+    Exit(-1);
   cp1:=TranslatePlaceholderCP(StringCodePage(S1));
   cp2:=TranslatePlaceholderCP(StringCodePage(S2));
   if cp1=cp2 then