diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/sexpr.cc | 1 | ||||
-rw-r--r-- | src/utils/string-pool.H | 13 | ||||
-rw-r--r-- | src/utils/string-pool.cc | 8 |
3 files changed, 13 insertions, 9 deletions
diff --git a/src/utils/sexpr.cc b/src/utils/sexpr.cc index 69dc7b72..9e57765f 100644 --- a/src/utils/sexpr.cc +++ b/src/utils/sexpr.cc @@ -32,6 +32,7 @@ // --% Author: Gabriel Dos Reis. #include <ctype.h> +#include <string.h> #include <iostream> #include <iterator> #include <open-axiom/sexpr> diff --git a/src/utils/string-pool.H b/src/utils/string-pool.H index ae90409b..311db1bf 100644 --- a/src/utils/string-pool.H +++ b/src/utils/string-pool.H @@ -1,4 +1,4 @@ -// Copyright (C) 2010, Gabriel Dos Reis. +// Copyright (C) 2010-2011, Gabriel Dos Reis. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -32,7 +32,6 @@ #ifndef OPENAXIOM_STRING_POOL_INCLUDED #define OPENAXIOM_STRING_POOL_INCLUDED -#include <string.h> #include <open-axiom/hash-table> // --% Author: Gabriel Dos Reis. @@ -62,17 +61,15 @@ namespace OpenAxiom { // ---------------- // -- StringPool -- // ---------------- - // A stringpool object is a repository of long-living string objects. - // It contains no duplicates, therefore allowing fast string - // object comparison for equality. + // A string-pool object is a repository of long-living string objects. + // It contains no duplicates, therefore allows fast equality + // comparison of string objects. struct StringPool : private BasicHashTable<StringItem> { using BasicHashTable<StringItem>::EntryType; StringPool(); // Intern a NUL-terminated sequence of characters. - EntryType* intern(const char* s) { - return intern(s, strlen(s)); - } + EntryType* intern(const char*); // Intern a sequence of characters given by its start and length. EntryType* intern(const char*, size_t); diff --git a/src/utils/string-pool.cc b/src/utils/string-pool.cc index 0c529ace..db5036a0 100644 --- a/src/utils/string-pool.cc +++ b/src/utils/string-pool.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2010, Gabriel Dos Reis. +// Copyright (C) 2010-2011, Gabriel Dos Reis. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -31,6 +31,7 @@ // --% Author: Gabriel Dos Reis +#include <string.h> #include <open-axiom/string-pool> namespace OpenAxiom { @@ -93,4 +94,9 @@ namespace OpenAxiom { e->hash = h; return e; } + + StringPool::EntryType* + StringPool::intern(const char* s) { + return intern(s, strlen(s)); + } } |