mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
Separate the KeywordExt from the list node that points to it.
This commit is contained in:
@@ -299,7 +299,7 @@ parse_line (const char *line, const char *delimiters)
|
||||
}
|
||||
lp++;
|
||||
}
|
||||
return new KeywordExt_List (key, kp - key, option[TYPE] ? lp : "");
|
||||
return new KeywordExt_List (new KeywordExt (key, kp - key, option[TYPE] ? lp : ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -312,7 +312,7 @@ parse_line (const char *line, const char *delimiters)
|
||||
else
|
||||
/* Skip the first delimiter. */
|
||||
rest = &line[len + 1];
|
||||
return new KeywordExt_List (line, len, option[TYPE] ? rest : "");
|
||||
return new KeywordExt_List (new KeywordExt (line, len, option[TYPE] ? rest : ""));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
#include "keyword-list.h"
|
||||
|
||||
/* Constructor. */
|
||||
KeywordExt_List::KeywordExt_List (const char *s, int s_len, const char *r)
|
||||
: KeywordExt (s, s_len, r), _cdr (NULL)
|
||||
KeywordExt_List::KeywordExt_List (KeywordExt *car)
|
||||
: _cdr (NULL), _car (car)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -26,19 +26,20 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
#include "keyword.h"
|
||||
|
||||
/* List node of a linear list. */
|
||||
class KeywordExt_List : private KeywordExt {
|
||||
/* List node of a linear list of Keyword. */
|
||||
class KeywordExt_List {
|
||||
public:
|
||||
/* Constructor. */
|
||||
KeywordExt_List (const char *allchars, int allchars_length, const char *rest);
|
||||
KeywordExt_List (KeywordExt *car);
|
||||
|
||||
/* Access to first element of list. */
|
||||
KeywordExt * first () { return this; }
|
||||
KeywordExt * first () { return _car; }
|
||||
/* Access to next element of list. */
|
||||
KeywordExt_List *& rest () { return _cdr; }
|
||||
|
||||
private:
|
||||
KeywordExt_List * _cdr;
|
||||
KeywordExt * const _car;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user