comparison gcc/ada/libgnat/a-strunb.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
4 -- -- 4 -- --
5 -- A D A . S T R I N G S . U N B O U N D E D -- 5 -- A D A . S T R I N G S . U N B O U N D E D --
6 -- -- 6 -- --
7 -- B o d y -- 7 -- B o d y --
8 -- -- 8 -- --
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- 9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
10 -- -- 10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under -- 11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- -- 12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- -- 13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
761 761
762 procedure Realloc_For_Chunk 762 procedure Realloc_For_Chunk
763 (Source : in out Unbounded_String; 763 (Source : in out Unbounded_String;
764 Chunk_Size : Natural) 764 Chunk_Size : Natural)
765 is 765 is
766 Growth_Factor : constant := 32; 766 Growth_Factor : constant := 2;
767 -- The growth factor controls how much extra space is allocated when 767 -- The growth factor controls how much extra space is allocated when
768 -- we have to increase the size of an allocated unbounded string. By 768 -- we have to increase the size of an allocated unbounded string. By
769 -- allocating extra space, we avoid the need to reallocate on every 769 -- allocating extra space, we avoid the need to reallocate on every
770 -- append, particularly important when a string is built up by repeated 770 -- append, particularly important when a string is built up by repeated
771 -- append operations of small pieces. This is expressed as a factor so 771 -- append operations of small pieces. This is expressed as a factor so
772 -- 32 means add 1/32 of the length of the string as growth space. 772 -- 2 means add 1/2 of the length of the string as growth space.
773 773
774 Min_Mul_Alloc : constant := Standard'Maximum_Alignment; 774 Min_Mul_Alloc : constant := Standard'Maximum_Alignment;
775 -- Allocation will be done by a multiple of Min_Mul_Alloc This causes 775 -- Allocation will be done by a multiple of Min_Mul_Alloc This causes
776 -- no memory loss as most (all?) malloc implementations are obliged to 776 -- no memory loss as most (all?) malloc implementations are obliged to
777 -- align the returned memory on the maximum alignment as malloc does not 777 -- align the returned memory on the maximum alignment as malloc does not