OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkTagList.h" | 10 #include "SkTagList.h" |
11 | 11 |
12 SkTagList::~SkTagList() | 12 SkTagList::~SkTagList() |
13 { | 13 { |
14 } | 14 } |
15 | 15 |
16 SkTagList* SkTagList::Find(SkTagList* rec, U8CPU tag) | 16 SkTagList* SkTagList::Find(SkTagList* rec, U8CPU tag) |
17 { | 17 { |
18 SkASSERT(tag < kSkTagListCount); | 18 SkASSERT(tag < kSkTagListCount); |
19 | 19 |
20 while (rec != NULL) | 20 while (rec != nullptr) |
21 { | 21 { |
22 if (rec->fTag == tag) | 22 if (rec->fTag == tag) |
23 break; | 23 break; |
24 rec = rec->fNext; | 24 rec = rec->fNext; |
25 } | 25 } |
26 return rec; | 26 return rec; |
27 } | 27 } |
28 | 28 |
29 void SkTagList::DeleteTag(SkTagList** head, U8CPU tag) | 29 void SkTagList::DeleteTag(SkTagList** head, U8CPU tag) |
30 { | 30 { |
31 SkASSERT(tag < kSkTagListCount); | 31 SkASSERT(tag < kSkTagListCount); |
32 | 32 |
33 SkTagList* rec = *head; | 33 SkTagList* rec = *head; |
34 SkTagList* prev = NULL; | 34 SkTagList* prev = nullptr; |
35 | 35 |
36 while (rec != NULL) | 36 while (rec != nullptr) |
37 { | 37 { |
38 SkTagList* next = rec->fNext; | 38 SkTagList* next = rec->fNext; |
39 | 39 |
40 if (rec->fTag == tag) | 40 if (rec->fTag == tag) |
41 { | 41 { |
42 if (prev) | 42 if (prev) |
43 prev->fNext = next; | 43 prev->fNext = next; |
44 else | 44 else |
45 *head = next; | 45 *head = next; |
46 delete rec; | 46 delete rec; |
47 break; | 47 break; |
48 } | 48 } |
49 prev = rec; | 49 prev = rec; |
50 rec = next; | 50 rec = next; |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 void SkTagList::DeleteAll(SkTagList* rec) | 54 void SkTagList::DeleteAll(SkTagList* rec) |
55 { | 55 { |
56 while (rec) | 56 while (rec) |
57 { | 57 { |
58 SkTagList* next = rec->fNext; | 58 SkTagList* next = rec->fNext; |
59 delete rec; | 59 delete rec; |
60 rec = next; | 60 rec = next; |
61 } | 61 } |
62 } | 62 } |
OLD | NEW |