diff mbox series

[Ada] Simplify code by reusing List_Length

Message ID 20210707162458.GA2542941@adacore.com
State New
Headers show
Series [Ada] Simplify code by reusing List_Length | expand

Commit Message

Pierre-Marie de Rodat July 7, 2021, 4:24 p.m. UTC
Code cleanup; semantics is unaffected.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* exp_disp.adb (CPP_Num_Prims): Reuse List_Length.
diff mbox series

Patch

diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -588,19 +588,7 @@  package body Exp_Disp is
          --  Otherwise, count the primitives of the enclosing CPP type
 
          else
-            declare
-               Count : Nat := 0;
-               Elmt  : Elmt_Id;
-
-            begin
-               Elmt := First_Elmt (Primitive_Operations (CPP_Typ));
-               while Present (Elmt) loop
-                  Count := Count + 1;
-                  Next_Elmt (Elmt);
-               end loop;
-
-               return Count;
-            end;
+            return List_Length (Primitive_Operations (CPP_Typ));
          end if;
       end if;
    end CPP_Num_Prims;