equal
deleted
inserted
replaced
233 * Return the size of the user data. |
233 * Return the size of the user data. |
234 * |
234 * |
235 * @return the size of the user data. |
235 * @return the size of the user data. |
236 */ |
236 */ |
237 size_t get_user_size() const { |
237 size_t get_user_size() const { |
238 assert(_base_addr, "Not wrapping any memory"); |
238 assert(_base_addr != NULL, "Not wrapping any memory"); |
239 return get_head_guard()->get_user_size(); |
239 return get_head_guard()->get_user_size(); |
240 } |
240 } |
241 |
241 |
242 /** |
242 /** |
243 * Return the user data pointer. |
243 * Return the user data pointer. |
244 * |
244 * |
245 * @return the user data pointer. |
245 * @return the user data pointer. |
246 */ |
246 */ |
247 u_char* get_user_ptr() const { |
247 u_char* get_user_ptr() const { |
248 assert(_base_addr, "Not wrapping any memory"); |
248 assert(_base_addr != NULL, "Not wrapping any memory"); |
249 return _base_addr + sizeof(GuardHeader); |
249 return _base_addr + sizeof(GuardHeader); |
250 } |
250 } |
251 |
251 |
252 /** |
252 /** |
253 * Release the wrapped pointer for resource freeing. |
253 * Release the wrapped pointer for resource freeing. |
279 Guard* get_tail_guard() const { return (Guard*) (get_user_ptr() + get_user_size()); }; |
279 Guard* get_tail_guard() const { return (Guard*) (get_user_ptr() + get_user_size()); }; |
280 void set_user_bytes(u_char ch) { |
280 void set_user_bytes(u_char ch) { |
281 memset(get_user_ptr(), ch, get_user_size()); |
281 memset(get_user_ptr(), ch, get_user_size()); |
282 } |
282 } |
283 |
283 |
284 public: |
284 public: |
285 /** |
285 /** |
286 * Return the total size required for wrapping the given user size. |
286 * Return the total size required for wrapping the given user size. |
287 * |
287 * |
288 * @return the total size required for wrapping the given user size. |
288 * @return the total size required for wrapping the given user size. |
289 */ |
289 */ |