| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // --- | 30 // --- |
| 31 // Author: Sanjay Ghemawat <opensource@google.com> | 31 // Author: Sanjay Ghemawat <opensource@google.com> |
| 32 // | 32 // |
| 33 // Some very basic linked list functions for dealing with using void * as | 33 // Some very basic linked list functions for dealing with using void * as |
| 34 // storage. | 34 // storage. |
| 35 | 35 |
| 36 #ifndef TCMALLOC_LINKED_LIST_H_ | 36 #ifndef TCMALLOC_LINKED_LIST_H_ |
| 37 #define TCMALLOC_LINKED_LIST_H_ | 37 #define TCMALLOC_LINKED_LIST_H_ |
| 38 | 38 |
| 39 #include <stddef.h> |
| 40 |
| 39 namespace tcmalloc { | 41 namespace tcmalloc { |
| 40 | 42 |
| 41 inline void *SLL_Next(void *t) { | 43 inline void *SLL_Next(void *t) { |
| 42 return *(reinterpret_cast<void**>(t)); | 44 return *(reinterpret_cast<void**>(t)); |
| 43 } | 45 } |
| 44 | 46 |
| 45 inline void SLL_SetNext(void *t, void *n) { | 47 inline void SLL_SetNext(void *t, void *n) { |
| 46 *(reinterpret_cast<void**>(t)) = n; | 48 *(reinterpret_cast<void**>(t)) = n; |
| 47 } | 49 } |
| 48 | 50 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 while (head) { | 93 while (head) { |
| 92 count++; | 94 count++; |
| 93 head = SLL_Next(head); | 95 head = SLL_Next(head); |
| 94 } | 96 } |
| 95 return count; | 97 return count; |
| 96 } | 98 } |
| 97 | 99 |
| 98 } // namespace tcmalloc | 100 } // namespace tcmalloc |
| 99 | 101 |
| 100 #endif // TCMALLOC_LINKED_LIST_H_ | 102 #endif // TCMALLOC_LINKED_LIST_H_ |
| OLD | NEW |