Skip to content

Commit d6a4618

Browse files
committed
updateObsolete now uses map based DotAttributes
to avoid duplicated attributes in the list of attributes as result of blind concatenation
1 parent 5d929c3 commit d6a4618

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/configimpl.l

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "fileinfo.h"
4444
#include "dir.h"
4545
#include "textstream.h"
46+
#include "dotgraph.h"
4647

4748
#define YY_NO_INPUT 1
4849
#define YY_NO_UNISTD_H 1
@@ -2064,13 +2065,11 @@ void Config::checkAndCorrect(bool quiet, const bool check)
20642065

20652066
}
20662067

2067-
static void appendAttribute(QCString& a, const char * name, ConfigObsolete* value)
2068+
static void appendAttribute(DotAttributes& attr, QCString name, ConfigObsolete* value)
20682069
{
20692070
if (!value || !value->valueStringRef()->length())
20702071
return;
2071-
if (a.length())
2072-
a += ' ';
2073-
a += name + QCString("=") + value->valueStringRef()->quoted();
2072+
attr[name] = *value->valueStringRef();
20742073
}
20752074

20762075
void Config::updateObsolete()
@@ -2113,15 +2112,19 @@ void Config::updateObsolete()
21132112
" You may want to clear or change DOT_FONTNAME.\n"
21142113
" Otherwise you run the risk that the wrong font is being used for dot generated graphs.\n");
21152114

2116-
QCString& common_attr = *dynamic_cast<ConfigString*>(ConfigImpl::instance()->get("DOT_COMMON_ATTR"))->valueRef();
2115+
QCString& common_attr_str = *dynamic_cast<ConfigString*>(ConfigImpl::instance()->get("DOT_COMMON_ATTR"))->valueRef();
2116+
DotAttributes common_attr{common_attr_str};
21172117

21182118
appendAttribute(common_attr, "fontname", fontname);
21192119
appendAttribute(common_attr, "fontsize", fontsize);
2120+
common_attr_str = common_attr.str();
21202121

2121-
QCString& edge_attr = *dynamic_cast<ConfigString*>(ConfigImpl::instance()->get("DOT_EDGE_ATTR"))->valueRef();
2122+
QCString& edge_attr_str = *dynamic_cast<ConfigString*>(ConfigImpl::instance()->get("DOT_EDGE_ATTR"))->valueRef();
2123+
DotAttributes edge_attr{edge_attr_str};
21222124

21232125
appendAttribute(edge_attr, "labelfontname", fontname);
21242126
appendAttribute(edge_attr, "labelfontsize", fontsize);
2127+
edge_attr_str = edge_attr.str();
21252128
}
21262129

21272130
void Config::writeTemplate(TextStream &t,bool shortList,bool update)

0 commit comments

Comments
 (0)