Avoid misplaced const via removing unneeded typedef

Found via clang-tidy.
This commit is contained in:
Andrew Gaul 2019-07-12 03:40:54 -07:00
parent 50d13255e4
commit efff9c01a6
3 changed files with 6 additions and 7 deletions

View File

@ -9,7 +9,6 @@ Checks: '
-google-runtime-int, -google-runtime-int,
-google-runtime-references, -google-runtime-references,
misc-*, misc-*,
-misc-misplaced-const,
-misc-redundant-expression, -misc-redundant-expression,
-misc-unused-parameters, -misc-unused-parameters,
modernize-*, modernize-*,

View File

@ -84,7 +84,7 @@ bool AdditionalHeader::Load(const char* file)
// read file // read file
string line; string line;
PADDHEAD paddhead; ADDHEAD *paddhead;
while(getline(AH, line)){ while(getline(AH, line)){
if('#' == line[0]){ if('#' == line[0]){
continue; continue;
@ -169,7 +169,7 @@ void AdditionalHeader::Unload()
is_enable = false; is_enable = false;
for(addheadlist_t::iterator iter = addheadlist.begin(); iter != addheadlist.end(); iter = addheadlist.erase(iter)){ for(addheadlist_t::iterator iter = addheadlist.begin(); iter != addheadlist.end(); iter = addheadlist.erase(iter)){
PADDHEAD paddhead = *iter; ADDHEAD *paddhead = *iter;
if(paddhead){ if(paddhead){
if(paddhead->pregex){ if(paddhead->pregex){
regfree(paddhead->pregex); regfree(paddhead->pregex);
@ -198,7 +198,7 @@ bool AdditionalHeader::AddHeader(headers_t& meta, const char* path) const
// Because to allow duplicate key, and then scanning the entire table. // Because to allow duplicate key, and then scanning the entire table.
// //
for(addheadlist_t::const_iterator iter = addheadlist.begin(); iter != addheadlist.end(); ++iter){ for(addheadlist_t::const_iterator iter = addheadlist.begin(); iter != addheadlist.end(); ++iter){
const PADDHEAD paddhead = *iter; const ADDHEAD *paddhead = *iter;
if(!paddhead){ if(!paddhead){
continue; continue;
} }
@ -251,7 +251,7 @@ bool AdditionalHeader::Dump() const
ssdbg << "Additional Header list[" << addheadlist.size() << "] = {" << endl; ssdbg << "Additional Header list[" << addheadlist.size() << "] = {" << endl;
for(addheadlist_t::const_iterator iter = addheadlist.begin(); iter != addheadlist.end(); ++iter, ++cnt){ for(addheadlist_t::const_iterator iter = addheadlist.begin(); iter != addheadlist.end(); ++iter, ++cnt){
const PADDHEAD paddhead = *iter; const ADDHEAD *paddhead = *iter;
ssdbg << " [" << cnt << "] = {" << endl; ssdbg << " [" << cnt << "] = {" << endl;

View File

@ -31,9 +31,9 @@ typedef struct add_header{
std::string basestring; std::string basestring;
std::string headkey; std::string headkey;
std::string headvalue; std::string headvalue;
}ADDHEAD, *PADDHEAD; }ADDHEAD;
typedef std::vector<PADDHEAD> addheadlist_t; typedef std::vector<ADDHEAD *> addheadlist_t;
class AdditionalHeader class AdditionalHeader
{ {