Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, Google Inc. | 1 // Copyright (c) 2011, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 // |*list|, and updates |*list| to point to the next element in the | 143 // |*list|, and updates |*list| to point to the next element in the |
| 144 // list. Returns the address of the element that was removed from the | 144 // list. Returns the address of the element that was removed from the |
| 145 // linked list. |list| must not be NULL. | 145 // linked list. |list| must not be NULL. |
| 146 void *FL_Pop(void **list) { | 146 void *FL_Pop(void **list) { |
| 147 void *result = *list; | 147 void *result = *list; |
| 148 ASSERT(FL_Previous_No_Check(result) == NULL); | 148 ASSERT(FL_Previous_No_Check(result) == NULL); |
| 149 *list = FL_Next(result); | 149 *list = FL_Next(result); |
| 150 if (*list != NULL) { | 150 if (*list != NULL) { |
| 151 FL_SetPrevious(*list, NULL); | 151 FL_SetPrevious(*list, NULL); |
| 152 } | 152 } |
| 153 // Maybe required here? : FL_SetNext(result, NULL); | |
|
jar (doing other things)
2012/03/01 19:36:38
An item pulled from the list is not guaranteed to
Dai Mikurube (NOT FULLTIME)
2012/03/01 21:04:11
Make sense. I don't change here.
| |
| 153 return result; | 154 return result; |
| 154 } | 155 } |
| 155 | 156 |
| 156 // Remove |n| elements from linked list at whose first element is at | 157 // Remove |n| elements from linked list at whose first element is at |
| 157 // |*head|. |head| will be modified to point to the new head. | 158 // |*head|. |head| will be modified to point to the new head. |
| 158 // |start| will point to the first node of the range, |end| will point | 159 // |start| will point to the first node of the range, |end| will point |
| 159 // to the last node in the range. |n| must be <= FL_Size(|*head|) | 160 // to the last node in the range. |n| must be <= FL_Size(|*head|) |
| 160 // If |n| > 0, |head| must not be NULL. | 161 // If |n| > 0, |head| must not be NULL. |
| 161 void FL_PopRange(void **head, int n, void **start, void **end) { | 162 void FL_PopRange(void **head, int n, void **start, void **end) { |
| 162 if (n == 0) { | 163 if (n == 0) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 | 221 |
| 221 namespace { | 222 namespace { |
| 222 | 223 |
| 223 inline void FL_SetNext(void *t, void *n) { | 224 inline void FL_SetNext(void *t, void *n) { |
| 224 tcmalloc::SLL_SetNext(t,n); | 225 tcmalloc::SLL_SetNext(t,n); |
| 225 } | 226 } |
| 226 | 227 |
| 227 } | 228 } |
| 228 | 229 |
| 229 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST | 230 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST |
| OLD | NEW |