Browse Source

* More efficient condition checks for "tnodeutils.has_init_list"

J. Gareth "Curious Kit" Moreton 11 months ago
parent
commit
a4ff1d185e
1 changed files with 10 additions and 5 deletions
  1. 10 5
      compiler/ngenutil.pas

+ 10 - 5
compiler/ngenutil.pas

@@ -1235,18 +1235,23 @@ implementation
     var
       hp : tused_unit;
     begin
-      Result:=false;
+      Result := True;
+
+      { Check current module first }
+      if mf_init in current_module.moduleflags then
+        Exit;
+
       { Check used units }
       hp:=tused_unit(usedunits.first);
-      while assigned(hp) and (Result=false) do
+      while assigned(hp) do
         begin
           if mf_init in hp.u.moduleflags then
-            Result:=true;
+            Exit;
           hp:=tused_unit(hp.next);
         end;
 
-      { Check current module }
-      Result:=Result or (mf_init in current_module.moduleflags);
+      { We reach this point, none of the used units have an initialisation list }
+      Result := False;
     end;