Re: Problems building 0.60.2 on HP-UX 11.x

Kevin Atkinson <[email protected]>
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <[email protected]>
On Wed, 22 Dec 2004, Gary Setter wrote:

> <snip>
>>       const char empty_str[1];
>>                  ^^^^^^^^^
> <snip>
> My cheap fix was to change the definition to of empty_str to
>  const char *empty_str;
> and initialize it to empty string in the constructors.
>  StringMap() : empty_str("") {}
>  StringMap(const StringMap & other) : empty_str("")
> {copy(other);}
>
> But the real question is, why do we need this?

It was a memory optimization that most likely isn't worth it.  The 
attached patch removes empty_str and replaces it with "".

_______________________________________________
Aspell-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/aspell-devel
cvs.diff (text/plain, 1.1 KB)
Index: common/string_map.hpp
===================================================================
RCS file: /cvsroot/aspell/aspell/common/string_map.hpp,v
retrieving revision 1.7
diff -u -r1.7 string_map.hpp
--- common/string_map.hpp	17 Jun 2004 12:41:47 -0000	1.7
+++ common/string_map.hpp	2 Jan 2005 02:22:45 -0000
@@ -38,7 +38,6 @@
 private:
   HashTable<Parms> lookup_;
   ObjStack buffer_;
-  const char empty_str[1];
 
   void copy(const StringMap & other);
   
@@ -46,8 +45,8 @@
 public:
   PosibErr<void> clear() {lookup_.clear(); buffer_.reset(); return no_err;}
   
-  StringMap() : empty_str() {}
-  StringMap(const StringMap & other) : empty_str() {copy(other);}
+  StringMap() {}    
+  StringMap(const StringMap & other) {copy(other);}
   StringMap & operator= (const StringMap & o) {clear(); copy(o); return *this;}
   ~StringMap() {}
   
@@ -76,7 +75,7 @@
     pair<Iter_,bool> res = lookup_.insert(Value_(key,0));
     if (res.second) {
       res.first->first  = buffer_.dup(key);
-      res.first->second = empty_str;
+      res.first->second = "";
       return true;
     } else {
       return false;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.