=================================================================== RCS file: /cvs/djgpp/djgpp/src/mkdoc/mkdoc.cc,v retrieving revision 1.42 retrieving revision 1.43 diff -p -u -r1.42 -r1.43 --- djgpp/src/mkdoc/mkdoc.cc 2008/08/18 09:04:09 1.42 +++ /cvs/djgpp/djgpp/src/mkdoc/mkdoc.cc 2008/08/18 17:25:55 1.43 @@ -161,9 +161,8 @@ struct PortNote { const PortInfo *pi; const PortQualifier *pq; int number; - char *note; - PortNote(const PortInfo *pt); - ~PortNote(); + std::string note; + PortNote(const PortInfo *pt) : next(NULL), pi(pt), pq(NULL), number(0), note("") {} }; struct Node { @@ -176,7 +175,6 @@ struct Node { static int count_nodes; Node(Lines &, const char *name, const char *fn); void process(const char *line); - void extend_portability_note(const char *str) const; void read_portability_note(const char *str); void read_portability(const char *str); void write_portability(void); @@ -200,15 +198,6 @@ Node::Node(Lines &l, const char *n, cons } void -Node::extend_portability_note(const char *str) const -{ - int newsize = strlen (last_port_note->note) + strlen (str) + 1; - char *newstring = (char *) realloc (last_port_note->note, newsize); - strcat (newstring, str); - last_port_note->note = newstring; -} - -void Node::read_portability_note(const char *str) { char *work_str = strdup (str); @@ -269,7 +258,8 @@ Node::read_portability_note(const char * } last_port_note = p; - if (*s) extend_portability_note (s); + if (*s) + last_port_note->note.append(s); } free (work_str); } @@ -583,7 +573,7 @@ Node::process(const char *line) /* If `last_port_note' is not NULL, we're in the middle of a note */ if (last_port_note) { - extend_portability_note(line); + last_port_note->note.append(line); } else { @@ -655,20 +645,6 @@ NodeSource::Warning(const char *str, ... va_end (arg); } -PortNote::PortNote(const PortInfo *pt) -{ - next = NULL; - number = 0; - pi = pt; - pq = NULL; - note = strdup (""); -} - -PortNote::~PortNote() -{ - free(note); -} - template TreeNode::TreeNode(const char *Pname, N *n) {