~ubuntu-branches/ubuntu/wily/trafficserver/wily

« back to all changes in this revision

Viewing changes to lib/wccp/WccpMsg.cc

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-12-17 22:28:16 UTC
  • mfrom: (5.1.8 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121217222816-7xwjsx5k76zkb63d
Tags: 3.2.0-1ubuntu1
* Revert FreeBSD strerror_r() fixes that give errors with glibc 2.16.
* Apply patch from Konstantinos Margaritis to define barriers on ARM.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
# include <errno.h>
25
25
# include <openssl/md5.h>
26
26
# include <TsException.h>
 
27
# include "ink_memory.h"
 
28
# include "ink_string.h"
27
29
 
28
30
namespace wccp {
29
31
// ------------------------------------------------------
91
93
CacheIdBox&
92
94
CacheIdBox::require(size_t n) {
93
95
  if (m_cap < n) {
94
 
    if (m_base && m_cap) free(m_base);
95
 
    m_base = static_cast<CacheIdElt*>(malloc(n));
 
96
    if (m_base && m_cap)
 
97
      ats_free(m_base);
 
98
    m_base = static_cast<CacheIdElt*>(ats_malloc(n));
96
99
    m_cap = n;
97
100
  }
98
101
  memset(m_base, 0, m_cap);
421
424
SecurityComp&
422
425
SecurityComp::setKey(char const* key) {
423
426
  m_local_key = true;
424
 
  memset(m_key, 0, KEY_SIZE);
425
427
  strncpy(m_key, key, KEY_SIZE);
426
428
  return *this;
427
429
}
428
430
 
429
431
void
430
432
SecurityComp::setDefaultKey(char const* key) {
431
 
  memset(m_default_key, 0, KEY_SIZE);
432
433
  strncpy(m_default_key, key, KEY_SIZE);
433
434
}
434
435
 
1535
1536
  // we don't have to do space checks when those get filled out.
1536
1537
  // The mask assignment is more difficult. We just guess generously and
1537
1538
  // try to recover if we go over.  
1538
 
  size_t size = RouterAssignListElt::calcSize(n_routers)
1539
 
    + HashAssignElt::calcSize(n_caches)
1540
 
    + 4096;
 
1539
  size_t size = RouterAssignListElt::calcSize(n_routers) + HashAssignElt::calcSize(n_caches) + 4096;
 
1540
 
1541
1541
  if (m_buffer.getSize() < size) {
1542
 
    free(m_buffer.getBase());
1543
 
    m_buffer.set(malloc(size), size);
 
1542
    ats_free(m_buffer.getBase());
 
1543
    m_buffer.set(ats_malloc(size), size);
1544
1544
  }
1545
1545
  m_buffer.reset();
1546
1546