Commit 77f7a0dd authored by David Gobbi's avatar David Gobbi
Browse files

Ensure that entries in hierarchy file are unique.

Previously, it only checked whether the entire line in the file was
unique.  Instead, it should verify that the entry itself is unique.
This became an issue in some C headers that had declarations of the
form "typedef struct X {} X;", causing X to appear both as a typedef
and as a class type.
parent 21224324
......@@ -39,6 +39,7 @@
#include "vtkParse.h"
#include "vtkParseData.h"
#include "vtkParseExtras.h"
#include "vtkParseMain.h"
#include "vtkParsePreprocess.h"
#include <stdio.h>
......@@ -56,14 +57,16 @@
*/
static char **append_unique_line(char **lines, char *line, size_t *np)
{
size_t l, n;
size_t l, n, m;
n = *np;
m = vtkParse_NameLength(line);
/* check to make sure this line isn't a duplicate */
for (l = 0; l < n; l++)
{
if (strcmp(line, lines[l]) == 0)
if (vtkParse_NameLength(lines[l]) == m &&
strncmp(line, lines[l], m) == 0)
{
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment