Re: [MERGE] wordlist refactoring

From: Adrian Chadd <adrian_at_freebsd.org>
Date: Wed, 13 Aug 2008 11:49:51 +0800

2008/8/13 Kinkie <gkinkie_at_gmail.com>:
> Hi all,
> this patch is an attempt at streamlining the wordlist implementation in
> 3.HEAD, by:
> - OO-izing it [1]
> - providing an unit-test for it
> - giving it a couple of convenience functions
> - documenting it
>
> It's still a work-in-progress, but in the end a wordlist would probably be
> better implemented by using a set of Strings anyways.
> It's however a step forward already, since it gives wordlist callers better
> c++ semantics than the current implementation in HEAD.
>
> The patch has been compile-tested, unit-tested, test-suite'd and run-tested.

Um, so you've not gotten rid of the ugly previous wordlist behaviour?

Why are you doing stuff like this?

+ *W += *regex_dump;
+ delete regex_dump;

Why not W->add(regex_dump)

?

Whats this:
const char *
+wordlist::add(const char *word)
+{
+ wordlist *cur=this;
+
+ if (key==NULL) { //special case empty wordlist
+ key = xstrdup(word);
+ return key;
+ }
+
+ while (cur->next != NULL)
+ cur = cur->next;
+
+ cur->next = new wordlist(word);
+
+ return word;
+}
Received on Wed Aug 13 2008 - 03:49:54 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 13 2008 - 12:00:05 MDT