public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2111] [Ada] Simplify code by reusing List_Length
@ 2021-07-07 16:25 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-07 16:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a7bb69067afdea57aadd10583342c315925d2cbd

commit r12-2111-ga7bb69067afdea57aadd10583342c315925d2cbd
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed May 19 12:06:55 2021 +0200

    [Ada] Simplify code by reusing List_Length
    
    gcc/ada/
    
            * exp_disp.adb (CPP_Num_Prims): Reuse List_Length.

Diff:
---
 gcc/ada/exp_disp.adb | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index a44af6a126e..e9d6e744d2c 100644
--- 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-07 16:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 16:25 [gcc r12-2111] [Ada] Simplify code by reusing List_Length Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).