Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd94ab8

Browse files
committed
Move plain_text guard inside html_head (addresses PR dspinellis#81 review)
1 parent 0e8c2f1 commit bd94ab8

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/cscout.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,7 @@ xfilequery_page(FILE *of, void *)
10661066

10671067
multiset <Fileid, FileQuery::specified_order> sorted_files;
10681068

1069-
if (!plain_text)
1070-
html_head(of, "xfilequery", (qname && *qname) ? qname : "File Query Results");
1069+
html_head(of, "xfilequery", (qname && *qname) ? qname : "File Query Results", NULL, plain_text);
10711070

10721071
for (vector <Fileid>::iterator i = files.begin(); i != files.end(); i++) {
10731072
if (query.eval(*i))
@@ -1360,8 +1359,7 @@ xiquery_page(FILE *of, void *)
13601359
return 0;
13611360
}
13621361

1363-
if (!plain_text)
1364-
html_head(of, "xiquery", (qname && *qname) ? qname : "Identifier Query Results");
1362+
html_head(of, "xiquery", (qname && *qname) ? qname : "Identifier Query Results", NULL, plain_text);
13651363
if (!quiet)
13661364
cerr << "Evaluating identifier query" << endl;
13671365
for (IdProp::iterator i = ids.begin(); i != ids.end(); i++) {
@@ -1421,8 +1419,7 @@ xfunquery_page(FILE *of, void *)
14211419
if (!query.is_valid())
14221420
return 0;
14231421

1424-
if (!plain_text)
1425-
html_head(of, "xfunquery", (qname && *qname) ? qname : "Function Query Results");
1422+
html_head(of, "xfunquery", (qname && *qname) ? qname : "Function Query Results", NULL, plain_text);
14261423
if (!quiet)
14271424
cerr << "Evaluating function query" << endl;
14281425
for (Call::const_fmap_iterator_type i = Call::fbegin(); i != Call::fend(); i++) {

src/html.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ html_string(FILE *of, string s)
141141
// Create a new HTML file with a given filename and title
142142
// The heading, if not given, will be the same as the title
143143
void
144-
html_head(FILE *of, const string fname, const string title, const char *heading)
144+
html_head(FILE *of, const string fname, const string title, const char *heading, bool plain_text)
145145
{
146+
if (plain_text)
147+
return;
146148
swill_title(title.c_str());
147149
if (DP())
148150
cerr << "Write to " << fname << endl;

src/html.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Call;
3636
const char * html(char c);
3737
string html(const string &s);
3838
void html_string(FILE *of, string s);
39-
void html_head(FILE *of, const string fname, const string title, const char *heading = NULL);
39+
void html_head(FILE *of, const string fname, const string title, const char *heading = NULL, bool plain_text = false);
4040
void html_tail(FILE *of);
4141
void html_perror(FILE *of, const string &user_msg, bool svg = false);
4242
void html_error(FILE *of, const string &user_msg);

0 commit comments

Comments
 (0)