Skip to content

Commit 21ee38c

Browse files
committed
coding style: write { at the begin of line
... when writing a function body, to make the coding style consistent again in this. Closes: https://github.com/kdudka/csdiff/pull/15
1 parent 174b799 commit 21ee38c

23 files changed

+230
-115
lines changed

src/abstract-filter.cc

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,26 @@ PredicateFilter::PredicateFilter(AbstractWriter *slave):
4949
{
5050
}
5151

52-
PredicateFilter::~PredicateFilter() {
52+
PredicateFilter::~PredicateFilter()
53+
{
5354
BOOST_FOREACH(IPredicate *pred, d->preds_)
5455
delete pred;
5556

5657
delete d;
5758
}
5859

59-
void PredicateFilter::append(IPredicate *pred) {
60+
void PredicateFilter::append(IPredicate *pred)
61+
{
6062
d->preds_.push_back(pred);
6163
}
6264

63-
void PredicateFilter::setInvertEachMatch(bool enabled) {
65+
void PredicateFilter::setInvertEachMatch(bool enabled)
66+
{
6467
d->invertEach_ = enabled;
6568
}
6669

67-
bool PredicateFilter::matchDef(const Defect &def) {
70+
bool PredicateFilter::matchDef(const Defect &def)
71+
{
6872
const bool neg = d->invertEach_;
6973

7074
BOOST_FOREACH(const IPredicate *pred, d->preds_) {
@@ -79,7 +83,8 @@ bool PredicateFilter::matchDef(const Defect &def) {
7983
// /////////////////////////////////////////////////////////////////////////////
8084
// implementation of EventPrunner
8185

82-
void EventPrunner::handleDef(const Defect &defOrig) {
86+
void EventPrunner::handleDef(const Defect &defOrig)
87+
{
8388
Defect def(defOrig);
8489
def.events.clear();
8590

@@ -100,7 +105,8 @@ void EventPrunner::handleDef(const Defect &defOrig) {
100105
// /////////////////////////////////////////////////////////////////////////////
101106
// implementation of CtxEmbedder
102107

103-
void dropCtxLines(TEvtList *pEvtList) {
108+
void dropCtxLines(TEvtList *pEvtList)
109+
{
104110
static CtxEventDetector detector;
105111

106112
TEvtList dst;
@@ -160,7 +166,8 @@ void appendCtxLines(
160166
}
161167
}
162168

163-
void CtxEmbedder::handleDef(const Defect &defOrig) {
169+
void CtxEmbedder::handleDef(const Defect &defOrig)
170+
{
164171
const DefEvent &evt = defOrig.events[defOrig.keyEventIdx];
165172
if (!evt.line) {
166173
// no line number for the key event

src/abstract-parser.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ AbstractParser* createParser(
5252
}
5353
}
5454

55-
EFileFormat Parser::inputFormat() const {
55+
EFileFormat Parser::inputFormat() const
56+
{
5657
if (dynamic_cast<JsonParser *>(parser_))
5758
return FF_JSON;
5859

src/abstract-writer.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
// /////////////////////////////////////////////////////////////////////////////
3030
// implementation of AbstractWriter
3131

32-
bool AbstractWriter::handleFile(Parser &parser, const std::string &fileName) {
32+
bool AbstractWriter::handleFile(Parser &parser, const std::string &fileName)
33+
{
3334
this->notifyFile(fileName);
3435

3536
// detect the input format and create the parser
@@ -56,7 +57,8 @@ bool AbstractWriter::handleFile(
5657
return this->handleFile(parser, fileName);
5758
}
5859

59-
bool AbstractWriter::handleFile(const std::string &fileName, bool silent) {
60+
bool AbstractWriter::handleFile(const std::string &fileName, bool silent)
61+
{
6062
try {
6163
InStream str(fileName.c_str());
6264
return this->handleFile(str.str(), fileName, silent);
@@ -67,7 +69,8 @@ bool AbstractWriter::handleFile(const std::string &fileName, bool silent) {
6769
}
6870
}
6971

70-
void AbstractWriter::setScanProps(const TScanProps &scanProps) {
72+
void AbstractWriter::setScanProps(const TScanProps &scanProps)
73+
{
7174
if (scanProps.empty())
7275
return;
7376

@@ -133,16 +136,19 @@ CtxEventDetector::CtxEventDetector():
133136
{
134137
}
135138

136-
CtxEventDetector::~CtxEventDetector() {
139+
CtxEventDetector::~CtxEventDetector()
140+
{
137141
delete d;
138142
}
139143

140-
bool CtxEventDetector::isAnyCtxLine(const DefEvent &evt) const {
144+
bool CtxEventDetector::isAnyCtxLine(const DefEvent &evt) const
145+
{
141146
return (evt.event == "#")
142147
&& boost::regex_match(evt.msg, d->reAnyCtxLine);
143148
}
144149

145-
bool CtxEventDetector::isKeyCtxLine(const DefEvent &evt) const {
150+
bool CtxEventDetector::isKeyCtxLine(const DefEvent &evt) const
151+
{
146152
return (evt.event == "#")
147153
&& boost::regex_match(evt.msg, d->reKeyCtxLine);
148154
}

src/color.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
#include <unistd.h>
2323

24-
ColorWriter::ColorWriter(const std::ostream &str, const EColorMode cm) {
24+
ColorWriter::ColorWriter(const std::ostream &str, const EColorMode cm)
25+
{
2526
switch (cm) {
2627
case CM_NEVER:
2728
enabled_ = false;
@@ -38,7 +39,8 @@ ColorWriter::ColorWriter(const std::ostream &str, const EColorMode cm) {
3839
}
3940
}
4041

41-
const char* ColorWriter::setColor(const EColor color) {
42+
const char* ColorWriter::setColor(const EColor color)
43+
{
4244
if (!enabled_)
4345
return "";
4446

@@ -53,6 +55,7 @@ const char* ColorWriter::setColor(const EColor color) {
5355
return "";
5456
}
5557

56-
const char* ColorWriter::setColorIf(bool cond, const EColor color) {
58+
const char* ColorWriter::setColorIf(bool cond, const EColor color)
59+
{
5760
return (cond) ? this->setColor(color) : "";
5861
}

src/color.hh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class ColorWriter {
4747
};
4848

4949
template <class TOptDesc>
50-
void addColorOptions(TOptDesc *desc) {
50+
void addColorOptions(TOptDesc *desc)
51+
{
5152
desc->add_options()
5253
("color",
5354
"use colorized console output (default if connected to a terminal)")
@@ -56,7 +57,8 @@ void addColorOptions(TOptDesc *desc) {
5657
}
5758

5859
template <class TValMap>
59-
bool readColorOptions(EColorMode *pDst, const char **pErr, const TValMap &vm) {
60+
bool readColorOptions(EColorMode *pDst, const char **pErr, const TValMap &vm)
61+
{
6062
const bool colorAlways = vm.count("color");
6163
const bool colorNever = vm.count("no-color");
6264
if (colorAlways && colorNever) {

src/csfilter.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,17 @@ MsgFilter::MsgFilter():
142142
{
143143
}
144144

145-
MsgFilter::~MsgFilter() {
145+
MsgFilter::~MsgFilter()
146+
{
146147
BOOST_FOREACH(TMsgFilterMap::const_reference item, d->msgFilterMap)
147148
BOOST_FOREACH(struct MsgReplace *rpl, item.second)
148149
delete rpl;
149150

150151
delete d;
151152
}
152153

153-
void MsgFilter::setIgnorePath(bool enable) {
154+
void MsgFilter::setIgnorePath(bool enable)
155+
{
154156
d->ignorePath = enable;
155157
}
156158

@@ -181,7 +183,8 @@ std::string MsgFilter::filterMsg(
181183
return filtered;
182184
}
183185

184-
std::string MsgFilter::filterPath(const std::string &origPath) {
186+
std::string MsgFilter::filterPath(const std::string &origPath)
187+
{
185188
std::string path = origPath;
186189

187190
TSubstMap &substMap = d->fileSubsts;

src/csgrep.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ bool chainFilters(
491491
}
492492

493493
template <class TDesc, class TStream>
494-
void printUsage(TStream &str, const TDesc &desc) {
494+
void printUsage(TStream &str, const TDesc &desc)
495+
{
495496
desc.print(str);
496497
}
497498

src/cshtml.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#include <boost/program_options.hpp>
2727
#include <boost/regex.hpp>
2828

29-
std::string titleFromFileName(const std::string &fileName) {
29+
std::string titleFromFileName(const std::string &fileName)
30+
{
3031
if (!fileName.compare("-"))
3132
return "";
3233

src/cslinker.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ void parseError(
4545
std::cerr << ": parse error: " << msg << "\n";
4646
}
4747

48-
void printError(const InFileException &e) {
48+
void printError(const InFileException &e)
49+
{
4950
std::cerr << e.fileName << ": failed to open input file\n";
5051
}
5152

@@ -102,11 +103,13 @@ class ImpFlagDecorator: public GenericAbstractFilter {
102103
DefLookup impSet_;
103104
};
104105

105-
void ImpFlagDecorator::hashImpDefect(const Defect &impDef) {
106+
void ImpFlagDecorator::hashImpDefect(const Defect &impDef)
107+
{
106108
impSet_.hashDefect(impDef);
107109
}
108110

109-
void ImpFlagDecorator::handleDef(const Defect &defOrig) {
111+
void ImpFlagDecorator::handleDef(const Defect &defOrig)
112+
{
110113
if (impSet_.lookup(defOrig)) {
111114
// found -> set "imp" flag to 1
112115
Defect def = defOrig;
@@ -131,7 +134,8 @@ class ParsingRulesDecorator: public GenericAbstractFilter {
131134
GccPostProcessor gccPostProc_;
132135
};
133136

134-
void ParsingRulesDecorator::handleDef(const Defect &defOrig) {
137+
void ParsingRulesDecorator::handleDef(const Defect &defOrig)
138+
{
135139
Defect def = defOrig;
136140
gccPostProc_.apply(&def);
137141
slave_->handleDef(def);
@@ -189,14 +193,16 @@ bool writeMappedDefects(
189193
}
190194

191195
template <class TVal, class TVar>
192-
inline TVal valueOf(const TVar &var) {
196+
inline TVal valueOf(const TVar &var)
197+
{
193198
if (var.empty())
194199
return TVal();
195200
else
196201
return var.template as<TVal>();
197202
}
198203

199-
int main(int argc, char *argv[]) {
204+
int main(int argc, char *argv[])
205+
{
200206
using std::string;
201207
const char *name = argv[0];
202208

0 commit comments

Comments
 (0)