Remove some unused code (error_context, fastlist, stats)

This commit is contained in:
Henrik Rydgård 2015-09-19 10:15:24 +02:00
parent 6ddbe00961
commit 45e3b7122b
11 changed files with 1 additions and 164 deletions

View File

@ -888,16 +888,11 @@ add_library(native STATIC
ext/native/base/colorutil.h
ext/native/base/display.cpp
ext/native/base/display.h
ext/native/base/error_context.cpp
ext/native/base/error_context.h
ext/native/base/fastlist.h
ext/native/base/fastlist_test.cpp
ext/native/base/functional.h
ext/native/base/linked_ptr.h
ext/native/base/logging.h
ext/native/base/mutex.h
ext/native/base/scoped_ptr.h
ext/native/base/stats.h
ext/native/base/stringutil.cpp
ext/native/base/stringutil.h
ext/native/base/timeutil.cpp

View File

@ -83,8 +83,6 @@ SOURCES += $$P/ext/native/audio/*.cpp \
$$P/ext/native/base/colorutil.cpp \
$$P/ext/native/base/compat.cpp \
$$P/ext/native/base/display.cpp \
$$P/ext/native/base/error_context.cpp \
$$P/ext/native/base/fastlist_test.cpp \
$$P/ext/native/base/stringutil.cpp \
$$P/ext/native/base/timeutil.cpp \
$$P/ext/native/data/compression.cpp \
@ -126,13 +124,10 @@ HEADERS += $$P/ext/native/audio/*.h \
$$P/ext/native/base/color.h \
$$P/ext/native/base/colorutil.h \
$$P/ext/native/base/display.h \
$$P/ext/native/base/error_context.h \
$$P/ext/native/base/fastlist.h \
$$P/ext/native/base/linked_ptr.h \
$$P/ext/native/base/logging.h \
$$P/ext/native/base/mutex.h \
$$P/ext/native/base/scoped_ptr.h \
$$P/ext/native/base/stats.h \
$$P/ext/native/base/stringutil.h \
$$P/ext/native/base/timeutil.h \
$$P/ext/native/data/compression.h \

View File

@ -15,7 +15,6 @@ LOCAL_SRC_FILES :=\
base/display.cpp \
base/timeutil.cpp \
base/colorutil.cpp \
base/error_context.cpp \
base/stringutil.cpp \
data/compression.cpp \
ext/rg_etc1/rg_etc1.cpp \

View File

@ -2,7 +2,6 @@ set(SRCS
colorutil.cpp
timeutil.cpp
../thread/threadutil.cpp
error_context.cpp
display.cpp
buffer.cpp
backtrace.cpp)

View File

@ -1,40 +0,0 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/error_context.h"
#include <vector>
// TODO: Fix this threadery
#ifndef _WIN32
#undef __THREAD
#define __THREAD
#endif
__THREAD std::vector<const char *> *_error_context_name;
__THREAD std::vector<const char *> *_error_context_data;
_ErrorContext::_ErrorContext(const char *name, const char *data) {
if (!_error_context_name) {
_error_context_name = new std::vector<const char *>();
_error_context_data = new std::vector<const char *>();
_error_context_name->reserve(16);
_error_context_data->reserve(16);
}
_error_context_name->push_back(name);
_error_context_data->push_back(data);
}
_ErrorContext::~_ErrorContext() {
_error_context_name->pop_back();
_error_context_data->pop_back();
}
void _ErrorContext::Log(const char *message) {
ILOG("EC: %s", message);
for (size_t i = 0; i < _error_context_name->size(); i++) {
if ((*_error_context_data)[i] != 0) {
ILOG("EC: %s: %s", (*_error_context_name)[i], (*_error_context_data)[i]);
} else {
ILOG("EC: %s: %s", (*_error_context_name)[i], (*_error_context_data)[i]);
}
}
}

View File

@ -1,18 +0,0 @@
#pragma once
// do not inherit
// TODO: Have the crash handler investigate the error context.
// Must only be constructed on the stack - DO NOT put these on the heap.
class _ErrorContext
{
public:
_ErrorContext(const char *name, const char *data = 0);
~_ErrorContext();
// Logs the current context stack.
static void Log(const char *message);
};
#define ErrorContext(...) _ErrorContext __ec(__VA_ARGS__)
#define LogErrorContext(msg) _ErrorContext::Log(msg)

View File

@ -1,39 +0,0 @@
#pragma once
// An inline fastlist is a fixed size array with a position counter.
// Objects stored in a fastlist must be copyable.
// [] returns the objects in consecutive order, up to and not including
// the value of .size().
// Order is not preserved when removing objects.
template<class T, int max_size>
class InlineFastList {
public:
InlineFastList() : count_(0) {}
~InlineFastList() {}
T& operator [](int index) { return data_[index]; }
const T& operator [](int index) const { return data_[index]; }
int size() const { return count_; }
void Add(T t) {
data_[count_++] = t;
}
void RemoveAt(int index) {
data_[index] = data_[count_ - 1];
count_--;
}
void Remove(T t) { // Requires operator==
for (int i = 0; i < count_; i++) {
if (data_[i] == t) {
RemoveAt(i);
return;
}
}
}
private:
T data_[max_size];
int count_;
};

View File

@ -1,19 +0,0 @@
#include "base/fastlist.h"
#include "base/logging.h"
/*
#include <gtest/gtest.h>
TEST(fastlist, AddRemove) {
InlineFastList<int, 8> list;
list.Add(8);
list.Remove(7);
EXPECT_EQ(1, list.size());
list.Remove(8);
EXPECT_EQ(0, list.size());
list.Add(1);
list.Add(2);
list.Add(3);
EXPECT_EQ(3, list.size());
}
*/

View File

@ -1,18 +0,0 @@
#pragma once
// Statistics collection. Not very developed.
#define STATS_ENABLE
#ifdef STATS_ENABLE
void IncrementStat(const char *name);
#define INCSTAT(name) IncrementStat(name);
#else
#define INCSTAT(name)
#endif

View File

@ -196,15 +196,11 @@
<ClInclude Include="base\colorutil.h" />
<ClInclude Include="base\compat.h" />
<ClInclude Include="base\display.h" />
<ClInclude Include="base\error_context.h" />
<ClInclude Include="base\fastlist.h" />
<ClInclude Include="base\functional.h" />
<ClInclude Include="base\linked_ptr.h" />
<ClInclude Include="base\logging.h" />
<ClInclude Include="base\mutex.h" />
<ClInclude Include="base\NativeApp.h" />
<ClInclude Include="base\scoped_ptr.h" />
<ClInclude Include="base\stats.h" />
<ClInclude Include="base\stringutil.h" />
<ClInclude Include="base\timeutil.h" />
<ClInclude Include="data\compression.h" />
@ -311,7 +307,6 @@
<ClCompile Include="base\colorutil.cpp" />
<ClCompile Include="base\compat.cpp" />
<ClCompile Include="base\display.cpp" />
<ClCompile Include="base\error_context.cpp" />
<ClCompile Include="base\PCMain.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@ -774,4 +769,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -87,9 +87,6 @@
<ClInclude Include="base\scoped_ptr.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="base\stats.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="gfx\gl_lost_manager.h">
<Filter>gfx</Filter>
</ClInclude>
@ -102,9 +99,6 @@
<ClInclude Include="base\timeutil.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="base\error_context.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="gfx\texture.h">
<Filter>gfx</Filter>
</ClInclude>
@ -183,9 +177,6 @@
<ClInclude Include="base\backtrace.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="base\fastlist.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="math\lin\aabb.h">
<Filter>math</Filter>
</ClInclude>
@ -410,9 +401,6 @@
<ClCompile Include="base\timeutil.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="base\error_context.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="gfx\texture.cpp">
<Filter>gfx</Filter>
</ClCompile>