| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 inline void *FL_Next(void *t) { | 63 inline void *FL_Next(void *t) { |
| 64 return SLL_Next(t); | 64 return SLL_Next(t); |
| 65 } | 65 } |
| 66 | 66 |
| 67 inline void FL_Init(void *t) { | 67 inline void FL_Init(void *t) { |
| 68 SLL_SetNext(t, NULL); | 68 SLL_SetNext(t, NULL); |
| 69 } | 69 } |
| 70 | 70 |
| 71 inline void FL_Push(void **list, void *element) { | 71 inline void FL_Push(void **list, void *element) { |
| 72 CHECK_NE(*list, element); |
| 72 SLL_Push(list,element); | 73 SLL_Push(list,element); |
| 73 } | 74 } |
| 74 | 75 |
| 75 inline void *FL_Pop(void **list) { | 76 inline void *FL_Pop(void **list) { |
| 76 return SLL_Pop(list); | 77 return SLL_Pop(list); |
| 77 } | 78 } |
| 78 | 79 |
| 79 // Removes |N| elements from a linked list to which |head| points. | 80 // Removes |N| elements from a linked list to which |head| points. |
| 80 // |head| will be modified to point to the new |head|. |start| and | 81 // |head| will be modified to point to the new |head|. |start| and |
| 81 // |end| will point to the first and last nodes of the range. Note | 82 // |end| will point to the first and last nodes of the range. Note |
| 82 // that |end| will point to NULL after this function is called. | 83 // that |end| will point to NULL after this function is called. |
| 83 inline void FL_PopRange(void **head, int n, void **start, void **end) { | 84 inline void FL_PopRange(void **head, int n, void **start, void **end) { |
| 84 SLL_PopRange(head, n, start, end); | 85 SLL_PopRange(head, n, start, end); |
| 85 } | 86 } |
| 86 | 87 |
| 87 inline void FL_PushRange(void **head, void *start, void *end) { | 88 inline void FL_PushRange(void **head, void *start, void *end) { |
| 88 SLL_PushRange(head,start,end); | 89 SLL_PushRange(head,start,end); |
| 89 } | 90 } |
| 90 | 91 |
| 91 inline size_t FL_Size(void *head) { | 92 inline size_t FL_Size(void *head) { |
| 92 return SLL_Size(head); | 93 return SLL_Size(head); |
| 93 } | 94 } |
| 94 | 95 |
| 95 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST | 96 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST |
| 96 | 97 |
| 97 } // namespace tcmalloc | 98 } // namespace tcmalloc |
| 98 | 99 |
| 99 #endif // TCMALLOC_FREE_LIST_H_ | 100 #endif // TCMALLOC_FREE_LIST_H_ |
| OLD | NEW |