Permalink
Browse files

Remove useless "assert" header

  • Loading branch information...
1 parent fb6f981 commit d51ee3dba1c9836c4674163ddde7f658d2dedec9 @rescrv committed Oct 14, 2013
Showing with 9 additions and 53 deletions.
  1. +0 −1 Makefile.am
  2. +9 −10 buffer.cc
  3. +0 −42 e/assert.h
View
@@ -12,7 +12,6 @@ pkgconfig_DATA = libe.pc
nobase_include_HEADERS =
nobase_include_HEADERS += e/array_ptr.h
-nobase_include_HEADERS += e/assert.h
nobase_include_HEADERS += e/atomic.h
nobase_include_HEADERS += e/bitfield.h
nobase_include_HEADERS += e/bitsteal.h
View
@@ -44,7 +44,6 @@
#include <iostream>
// e
-#include "e/assert.h"
#include "e/buffer.h"
#include "e/endian.h"
@@ -111,7 +110,7 @@ e :: buffer :: pack_at(uint32_t off)
void
e :: buffer :: resize(uint32_t sz) throw ()
{
- EASSERT(sz <= m_cap);
+ assert(sz <= m_cap);
m_size = sz;
}
@@ -175,7 +174,7 @@ e :: buffer :: packer :: packer(buffer* buf, uint32_t off)
: m_buf(buf)
, m_off(off)
{
- EASSERT(off <= m_buf->m_cap);
+ assert(off <= m_buf->m_cap);
}
e :: buffer :: packer :: packer(const packer& p)
@@ -188,7 +187,7 @@ e::buffer::packer
e :: buffer :: packer :: copy(const slice& from)
{
uint64_t newsize = m_off + from.size();
- EASSERT(newsize <= m_buf->m_cap);
+ assert(newsize <= m_buf->m_cap);
memmove(m_buf->m_data + m_off, from.data(), from.size());
m_buf->m_size = std::max(m_buf->m_size, static_cast<uint32_t>(newsize));
return packer(m_buf, newsize);
@@ -226,7 +225,7 @@ e::buffer::packer
e :: buffer :: packer :: operator << (uint8_t rhs)
{
uint64_t newsize = m_off + sizeof(uint8_t);
- EASSERT(newsize <= m_buf->m_cap);
+ assert(newsize <= m_buf->m_cap);
e::pack8be(rhs, m_buf->m_data + m_off);
m_buf->m_size = std::max(m_buf->m_size, static_cast<uint32_t>(newsize));
return packer(m_buf, newsize);
@@ -236,7 +235,7 @@ e::buffer::packer
e :: buffer :: packer :: operator << (uint16_t rhs)
{
uint64_t newsize = m_off + sizeof(uint16_t);
- EASSERT(newsize <= m_buf->m_cap);
+ assert(newsize <= m_buf->m_cap);
e::pack16be(rhs, m_buf->m_data + m_off);
m_buf->m_size = std::max(m_buf->m_size, static_cast<uint32_t>(newsize));
return packer(m_buf, newsize);
@@ -246,7 +245,7 @@ e::buffer::packer
e :: buffer :: packer :: operator << (uint32_t rhs)
{
uint64_t newsize = m_off + sizeof(uint32_t);
- EASSERT(newsize <= m_buf->m_cap);
+ assert(newsize <= m_buf->m_cap);
e::pack32be(rhs, m_buf->m_data + m_off);
m_buf->m_size = std::max(m_buf->m_size, static_cast<uint32_t>(newsize));
return packer(m_buf, newsize);
@@ -256,7 +255,7 @@ e::buffer::packer
e :: buffer :: packer :: operator << (uint64_t rhs)
{
uint64_t newsize = m_off + sizeof(uint64_t);
- EASSERT(newsize <= m_buf->m_cap);
+ assert(newsize <= m_buf->m_cap);
e::pack64be(rhs, m_buf->m_data + m_off);
m_buf->m_size = std::max(m_buf->m_size, static_cast<uint32_t>(newsize));
return packer(m_buf, newsize);
@@ -266,8 +265,8 @@ e::buffer::packer
e :: buffer :: packer :: operator << (const slice& rhs)
{
uint64_t newsize = m_off + sizeof(uint32_t) + rhs.size();
- EASSERT(newsize <= m_buf->m_cap);
- EASSERT(rhs.size() <= UINT32_MAX);
+ assert(newsize <= m_buf->m_cap);
+ assert(rhs.size() <= UINT32_MAX);
uint32_t sz = rhs.size();
e::pack32be(sz, m_buf->m_data + m_off);
memmove(m_buf->m_data + m_off + sizeof(uint32_t), rhs.data(), sz);
View
@@ -1,42 +0,0 @@
-// Copyright (c) 2011, Robert Escriva
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// * Neither the name of this project nor the names of its contributors may
-// be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef e_assert_h_
-#define e_assert_h_
-
-// C
-#include <cassert>
-
-#ifdef _MSC_VER
-#define EASSERT(expr) \
- assert(expr)
-#else
-#define EASSERT(expr) \
- assert(__builtin_expect(expr, 1))
-#endif
-
-#endif // e_assert_h_

0 comments on commit d51ee3d

Please sign in to comment.