@@ -180,14 +180,14 @@ void print_nameMap() {
180
180
}
181
181
182
182
183
- string a_title (const string &init, const string &name) {
183
+ string a_title (const string &init, const string &name) {
184
184
char begin = init[0 ];
185
185
string row = init;
186
186
row += name;
187
187
return row + begin;
188
188
}
189
189
190
- string a_data ( string init, struct data d) {
190
+ string a_data ( const string & init, struct data d) {
191
191
char begin = init[0 ];
192
192
string row = init;
193
193
string str_d = unit_format (d.value );
@@ -198,7 +198,7 @@ string a_data (string init, struct data d) {
198
198
return row + begin;
199
199
}
200
200
201
- string build_line (string init, string name, bool last_char = true , char this_char = ' _' )
201
+ string build_line (const string & init, const string & name, bool last_char = true , char this_char = ' _' )
202
202
{
203
203
char begin = init[0 ];
204
204
string row = init;
@@ -209,12 +209,12 @@ string build_line(string init, string name, bool last_char = true, char this_cha
209
209
}
210
210
211
211
212
- string a_header_footer ( string init, string name)
212
+ string a_header_footer ( const string & init, const string & name)
213
213
{
214
214
return build_line (init, name);
215
215
}
216
216
217
- vector<string> combine_stack_name_and_counter_names (string stack_name)
217
+ vector<string> combine_stack_name_and_counter_names (const string & stack_name)
218
218
{
219
219
220
220
vector<string> v;
@@ -223,7 +223,7 @@ vector<string> combine_stack_name_and_counter_names(string stack_name)
223
223
for (std::map<string,std::pair<h_id,std::map<string,v_id>>>::const_iterator iunit = nameMap.begin (); iunit != nameMap.end (); ++iunit) {
224
224
string h_name = iunit->first ;
225
225
int h_id = (iunit->second ).first ;
226
- tmp[h_id] = h_name;
226
+ tmp[h_id] = std::move ( h_name) ;
227
227
// cout << "h_id:" << h_id << " name:" << h_name << "\n";
228
228
}
229
229
// XXX: How to simplify and just combine tmp & v?
@@ -350,7 +350,7 @@ vector<string> build_display(vector<struct iio_stacks_on_socket>& iios, vector<s
350
350
351
351
std::string build_csv_row (const std::vector<std::string>& chunks, const std::string& delimiter)
352
352
{
353
- return std::accumulate (chunks.begin (), chunks.end (), std::string (" " ),
353
+ return std::accumulate (chunks.begin (), chunks.end (), std::string (),
354
354
[delimiter](const string &left, const string &right){
355
355
return left.empty () ? right : left + delimiter + right;
356
356
});
@@ -544,7 +544,7 @@ bool IPlatformMapping10Nm::getSadIdRootBusMap(uint32_t socket_id, std::map<uint8
544
544
545
545
if ((sad_ctrl_cfg & 0xf ) == socket_id) {
546
546
uint8_t sid = (sad_ctrl_cfg >> 4 ) & 0x7 ;
547
- sad_id_bus_map.insert (std::pair< uint8_t , uint8_t >( sid, (uint8_t )bus) );
547
+ sad_id_bus_map.emplace ( sid, (uint8_t )bus);
548
548
}
549
549
}
550
550
}
@@ -920,19 +920,19 @@ vector<struct counter> load_events(PCM * m, const char* fn)
920
920
/* Ignore anyline with # */
921
921
// TODO: substring until #, if len == 0, skip, else parse normally
922
922
pccr->set_ccr_value (0 );
923
- if (line.find (" # " ) != std::string::npos)
923
+ if (line.find (' # ' ) != std::string::npos)
924
924
continue ;
925
925
/* If line does not have any deliminator, we ignore it as well */
926
- if (line.find (" = " ) == std::string::npos)
926
+ if (line.find (' = ' ) == std::string::npos)
927
927
continue ;
928
928
std::istringstream iss (line);
929
929
string h_name, v_name;
930
930
while (std::getline (iss, item, ' ,' )) {
931
931
std::string key, value;
932
932
uint64 numValue;
933
933
/* assume the token has the format <key>=<value> */
934
- key = item.substr (0 ,item.find (" = " ));
935
- value = item.substr (item.find (" = " )+1 );
934
+ key = item.substr (0 ,item.find (' = ' ));
935
+ value = item.substr (item.find (' = ' )+1 );
936
936
istringstream iss2 (value);
937
937
iss2 >> setbase (0 ) >> numValue;
938
938
@@ -1119,11 +1119,11 @@ bool extract_argument_value(const char* arg, std::initializer_list<const char*>
1119
1119
const auto arg_name_len = strlen (arg_name);
1120
1120
if (arg_len > arg_name_len && strncmp (arg, arg_name, arg_name_len) == 0 && arg[arg_name_len] == ' =' ) {
1121
1121
value = arg + arg_name_len + 1 ;
1122
- const auto last_pos = value.find_last_not_of (" \" " );
1122
+ const auto last_pos = value.find_last_not_of (' \" ' );
1123
1123
if (last_pos != string::npos) {
1124
1124
value.erase (last_pos + 1 );
1125
1125
}
1126
- const auto first_pos = value.find_first_not_of (" \" " );
1126
+ const auto first_pos = value.find_first_not_of (' \" ' );
1127
1127
if (first_pos != string::npos) {
1128
1128
value.erase (0 , first_pos);
1129
1129
}
0 commit comments