Skip to content

Commit

Permalink
qmake|StringPool: Removed build option "deng_stringpoolzoneallocs"
Browse files Browse the repository at this point in the history
StringPool will shortly be transitioning to de::String plus there
is little benefit to allocating a pooled string from the Zone.
  • Loading branch information
danij-deng committed Nov 7, 2012
1 parent fbd9e66 commit b65cd8e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 27 deletions.
1 change: 0 additions & 1 deletion doomsday/config.pri
Expand Up @@ -27,7 +27,6 @@
# - deng_nopackres Do not package the Doomsday resources
# - deng_rangecheck Parameter range checking/value assertions
# - deng_snowberry (Unix) Include Snowberry in installation
# - deng_stringpoolzoneallocs Use the memory Zone for allocs in StringPool
# - deng_tests Build and deploy the test suite
# - deng_writertypecheck Enable type checking in Writer/Reader
#
Expand Down
6 changes: 0 additions & 6 deletions doomsday/libdeng/include/de/stringpool.h
Expand Up @@ -3,10 +3,6 @@
*
* String pool (case insensitive). @ingroup base
*
* @par Build Options
* Define the macro @c DENG_STRINGPOOL_ZONE_ALLOCS to make StringPool allocate
* memory from the memory zone instead of with system malloc().
*
* @author Copyright &copy; 2010-2012 Daniel Swanson <danij@dengine.net>
* @author Copyright &copy; 2012 Jaakko Keränen <jaakko.keranen@iki.fi>
*
Expand All @@ -28,8 +24,6 @@
#ifndef LIBDENG_STRINGPOOL_H
#define LIBDENG_STRINGPOOL_H

//#define DENG_STRINGPOOL_ZONE_ALLOCS

#ifdef __cplusplus
#ifndef DENG2_C_API_ONLY

Expand Down
4 changes: 0 additions & 4 deletions doomsday/libdeng/libdeng.pro
Expand Up @@ -46,10 +46,6 @@ deng_writertypecheck {
DEFINES += DENG_WRITER_TYPECHECK
}

deng_stringpoolzoneallocs {
DEFINES += DENG_STRINGPOOL_ZONE_ALLOCS
}

# Source Files ---------------------------------------------------------------

# Public headers
Expand Down
19 changes: 3 additions & 16 deletions doomsday/libdeng/src/stringpool.cpp
Expand Up @@ -21,7 +21,6 @@
*/

#include "de/memory.h"
#include "de/memoryzone.h"
#include "de/str.hh"
#include "de/stringpool.h"
#include "de/unittest.h"
Expand All @@ -38,14 +37,6 @@
# define strdup _strdup
#endif

#ifdef DENG_STRINGPOOL_ZONE_ALLOCS
# define STRINGPOOL_STRDUP(x) Z_StrDup(x)
# define STRINGPOOL_FREE(x) Z_Free(x)
#else
# define STRINGPOOL_STRDUP(x) strdup(x)
# define STRINGPOOL_FREE(x) M_Free(x)
#endif

/// Macro used for converting internal ids to externally visible Ids.
#define EXPORT_ID(i) (uint(i) + 1)
#define IMPORT_ID(i) (Id((i) - 1))
Expand Down Expand Up @@ -221,7 +212,7 @@ struct StringPool::Instance
*/
InternalId copyAndAssignUniqueId(char const* text)
{
CaselessStr* str = new CaselessStr(STRINGPOOL_STRDUP(text));
CaselessStr* str = new CaselessStr(strdup(text));

// This is a new string that is added to the pool.
interns.insert(str); // O(log n)
Expand All @@ -231,7 +222,7 @@ struct StringPool::Instance

void destroyStr(CaselessStr* str)
{
STRINGPOOL_FREE(str->toCString()); // duplicated cstring
M_Free(str->toCString()); // duplicated cstring
delete str; // CaselessStr instance
}

Expand Down Expand Up @@ -473,7 +464,7 @@ void StringPool::read(Reader* reader)
CaselessStr* str = new CaselessStr;
str->deserialize(reader, &text);
// Create a copy of the string whose ownership StringPool controls.
str->setText(STRINGPOOL_STRDUP(Str_Text(&text)));
str->setText(strdup(Str_Text(&text)));
d->interns.insert(str);
Str_Free(&text);

Expand Down Expand Up @@ -527,10 +518,6 @@ void StringPool::print() const
#ifdef _DEBUG
LIBDENG_DEFINE_UNITTEST(StringPool)
{
#ifdef DENG_STRINGPOOL_ZONE_ALLOCS
return 0; // Zone is not available yet.
#endif

de::StringPool p;
ddstring_t* s = Str_NewStd();
ddstring_t* s2 = Str_NewStd();
Expand Down

0 comments on commit b65cd8e

Please sign in to comment.