OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 int DLL_Length(const Span* list) { | 84 int DLL_Length(const Span* list) { |
85 int result = 0; | 85 int result = 0; |
86 for (Span* s = list->next; s != list; s = s->next) { | 86 for (Span* s = list->next; s != list; s = s->next) { |
87 result++; | 87 result++; |
88 } | 88 } |
89 return result; | 89 return result; |
90 } | 90 } |
91 | 91 |
92 #if 0 // This isn't used. If that changes, rewrite to use TCMalloc_Printer. | |
93 void DLL_Print(const char* label, const Span* list) { | |
94 MESSAGE("%-10s %p:", label, list); | |
95 for (const Span* s = list->next; s != list; s = s->next) { | |
96 MESSAGE(" <%p,%"PRIuPTR",%"PRIuPTR">", s, s->start, s->length); | |
97 } | |
98 MESSAGE("%s\n", ""); // %s is to get around a compiler error. | |
99 } | |
100 #endif | |
101 | |
102 void DLL_Prepend(Span* list, Span* span) { | 92 void DLL_Prepend(Span* list, Span* span) { |
103 ASSERT(span->next == NULL); | 93 ASSERT(span->next == NULL); |
104 ASSERT(span->prev == NULL); | 94 ASSERT(span->prev == NULL); |
105 span->next = list->next; | 95 span->next = list->next; |
106 span->prev = list; | 96 span->prev = list; |
107 list->next->prev = span; | 97 list->next->prev = span; |
108 list->next = span; | 98 list->next = span; |
109 } | 99 } |
110 | 100 |
111 } // namespace tcmalloc | 101 } // namespace tcmalloc |
OLD | NEW |