15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2011 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/zap.h"
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void ZapBuf(void* buf, size_t buf_len) {
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  memset(buf, 0x0, buf_len);
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void ZapString(std::string* s) {
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  if (!s->empty())
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ZapBuf(&(*s)[0], s->length() * sizeof(char));
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
18c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)void ZapString(base::string16* s) {
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  if (!s->empty())
207d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)    ZapBuf(&(*s)[0], s->length() * sizeof(base::char16));
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // net
24