Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: src/allocation.h

Issue 414033: Change the signature for StrNDup to match the implementation. This... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 template <typename T> 117 template <typename T>
118 static void DeleteArray(T* array) { 118 static void DeleteArray(T* array) {
119 delete[] array; 119 delete[] array;
120 } 120 }
121 121
122 122
123 // The normal strdup functions use malloc. These versions of StrDup 123 // The normal strdup functions use malloc. These versions of StrDup
124 // and StrNDup uses new and calls the FatalProcessOutOfMemory handler 124 // and StrNDup uses new and calls the FatalProcessOutOfMemory handler
125 // if allocation fails. 125 // if allocation fails.
126 char* StrDup(const char* str); 126 char* StrDup(const char* str);
127 char* StrNDup(const char* str, size_t n); 127 char* StrNDup(const char* str, int n);
128 128
129 129
130 // Allocation policy for allocating in the C free store using malloc 130 // Allocation policy for allocating in the C free store using malloc
131 // and free. Used as the default policy for lists. 131 // and free. Used as the default policy for lists.
132 class FreeStoreAllocationPolicy { 132 class FreeStoreAllocationPolicy {
133 public: 133 public:
134 INLINE(static void* New(size_t size)) { return Malloced::New(size); } 134 INLINE(static void* New(size_t size)) { return Malloced::New(size); }
135 INLINE(static void Delete(void* p)) { Malloced::Delete(p); } 135 INLINE(static void Delete(void* p)) { Malloced::Delete(p); }
136 }; 136 };
137 137
(...skipping 22 matching lines...) Expand all
160 160
161 void LinkTo(PreallocatedStorage* other); 161 void LinkTo(PreallocatedStorage* other);
162 void Unlink(); 162 void Unlink();
163 DISALLOW_IMPLICIT_CONSTRUCTORS(PreallocatedStorage); 163 DISALLOW_IMPLICIT_CONSTRUCTORS(PreallocatedStorage);
164 }; 164 };
165 165
166 166
167 } } // namespace v8::internal 167 } } // namespace v8::internal
168 168
169 #endif // V8_ALLOCATION_H_ 169 #endif // V8_ALLOCATION_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698