| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 61 | 61 | 
| 62 #include <stddef.h> | 62 #include <stddef.h> | 
| 63 #include "free_list.h" | 63 #include "free_list.h" | 
| 64 | 64 | 
| 65 #if defined(TCMALLOC_USE_DOUBLYLINKED_FREELIST) | 65 #if defined(TCMALLOC_USE_DOUBLYLINKED_FREELIST) | 
| 66 | 66 | 
| 67 using tcmalloc::kCrash; | 67 using tcmalloc::kCrash; | 
| 68 | 68 | 
| 69 // TODO(jar): We should use C++ rather than a macro here. | 69 // TODO(jar): We should use C++ rather than a macro here. | 
| 70 #define MEMORY_CHECK(v1, v2) \ | 70 #define MEMORY_CHECK(v1, v2) \ | 
| 71   if (v1 != v2) Log(kCrash, __FILE__, __LINE__, "Memory corruption detected.\n") | 71   if (v1 != v2) Log(kCrash, __FILE__, __LINE__, "Memory corruption detected.") | 
| 72 | 72 | 
| 73 namespace { | 73 namespace { | 
| 74 void EnsureNonLoop(void* node, void* next) { | 74 void EnsureNonLoop(void* node, void* next) { | 
| 75   // We only have time to do minimal checking.  We don't traverse the list, but | 75   // We only have time to do minimal checking.  We don't traverse the list, but | 
| 76   // only look for an immediate loop (cycle back to ourself). | 76   // only look for an immediate loop (cycle back to ourself). | 
| 77   if (node != next) return; | 77   if (node != next) return; | 
| 78   Log(kCrash, __FILE__, __LINE__, "Circular loop in list detected: %p\n", next); | 78   Log(kCrash, __FILE__, __LINE__, "Circular loop in list detected: ", next); | 
| 79 } | 79 } | 
| 80 | 80 | 
| 81 // Returns value of the |previous| pointer w/out running a sanity | 81 // Returns value of the |previous| pointer w/out running a sanity | 
| 82 // check. | 82 // check. | 
| 83 inline void *FL_Previous_No_Check(void *t) { | 83 inline void *FL_Previous_No_Check(void *t) { | 
| 84   return reinterpret_cast<void**>(t)[1]; | 84   return reinterpret_cast<void**>(t)[1]; | 
| 85 } | 85 } | 
| 86 | 86 | 
| 87 // Returns value of the |next| pointer w/out running a sanity check. | 87 // Returns value of the |next| pointer w/out running a sanity check. | 
| 88 inline void *FL_Next_No_Check(void *t) { | 88 inline void *FL_Next_No_Check(void *t) { | 
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 222 | 222 | 
| 223 namespace { | 223 namespace { | 
| 224 | 224 | 
| 225 inline void FL_SetNext(void *t, void *n) { | 225 inline void FL_SetNext(void *t, void *n) { | 
| 226   tcmalloc::SLL_SetNext(t,n); | 226   tcmalloc::SLL_SetNext(t,n); | 
| 227 } | 227 } | 
| 228 | 228 | 
| 229 } | 229 } | 
| 230 | 230 | 
| 231 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST | 231 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST | 
| OLD | NEW | 
|---|