Ada 95 foundation library
修订版 | 043aa2f37bbdc6501064f1ba82371be66d1ba3da (tree) |
---|---|
时间 | 2019-09-30 02:16:02 |
作者 | Sergey Dukov <dukov54@live...> |
Commiter | Sergey Dukov |
#32763 disable change counter for Empty_Referenced_Buffer
@@ -26,6 +26,9 @@ | ||
26 | 26 | |
27 | 27 | procedure Reference (Item : Referenced_Buffer_Access) is |
28 | 28 | begin |
29 | + if Item = Empty_Referenced_Buffer'Access then | |
30 | + return; | |
31 | + end if; | |
29 | 32 | Atomic_Counters.Increment (Item.Counter); |
30 | 33 | end Reference; |
31 | 34 |
@@ -40,17 +43,20 @@ | ||
40 | 43 | Aux : Referenced_Buffer_Access := Item; |
41 | 44 | Release : Boolean; |
42 | 45 | begin |
46 | + if Aux = Empty_Referenced_Buffer'Access then | |
47 | + return; | |
48 | + end if; | |
43 | 49 | Decrement (Aux.Counter, Release); |
44 | 50 | if Release then |
45 | 51 | -- Reference counter of Empty_Referenced_Buffer should never reach |
46 | 52 | -- zero. We check here in case it wraps around. |
47 | - if Aux /= Empty_Referenced_Buffer'Access then | |
53 | +-- if Aux /= Empty_Referenced_Buffer'Access then | |
48 | 54 | if not Is_One(Aux.Lock_Counter) then |
49 | 55 | Raise_Exception(Buffer_Locked'Identity, |
50 | 56 | "Buffer is locked for change"); |
51 | 57 | end if; |
52 | 58 | Free (Aux); |
53 | - end if; | |
59 | +-- end if; | |
54 | 60 | end if; |
55 | 61 | end Unreference; |
56 | 62 |
@@ -145,6 +151,9 @@ | ||
145 | 151 | Length : Natural) return Boolean |
146 | 152 | is |
147 | 153 | begin |
154 | + if Item = Empty_Referenced_Buffer'Access then | |
155 | + return False; | |
156 | + end if; | |
148 | 157 | return |
149 | 158 | Atomic_Counters.Is_One (Item.Counter) |
150 | 159 | and then Item.Max_Length >= Length |