@@ -1349,6 +1349,16 @@ struct dso *machine__findnew_kernel(struct machine *machine, const char *name,
1349
1349
return dso ;
1350
1350
}
1351
1351
1352
+ static void __dso__set_long_name_id (struct dso * dso , const char * name , bool name_allocated )
1353
+ {
1354
+ if (dso__long_name_allocated (dso ))
1355
+ free ((char * )dso__long_name (dso ));
1356
+
1357
+ RC_CHK_ACCESS (dso )-> long_name = name ;
1358
+ RC_CHK_ACCESS (dso )-> long_name_len = strlen (name );
1359
+ dso__set_long_name_allocated (dso , name_allocated );
1360
+ }
1361
+
1352
1362
static void dso__set_long_name_id (struct dso * dso , const char * name , bool name_allocated )
1353
1363
{
1354
1364
struct dsos * dsos = dso__dsos (dso );
@@ -1362,18 +1372,11 @@ static void dso__set_long_name_id(struct dso *dso, const char *name, bool name_a
1362
1372
* renaming the dso.
1363
1373
*/
1364
1374
down_write (& dsos -> lock );
1365
- }
1366
-
1367
- if (dso__long_name_allocated (dso ))
1368
- free ((char * )dso__long_name (dso ));
1369
-
1370
- RC_CHK_ACCESS (dso )-> long_name = name ;
1371
- RC_CHK_ACCESS (dso )-> long_name_len = strlen (name );
1372
- dso__set_long_name_allocated (dso , name_allocated );
1373
-
1374
- if (dsos ) {
1375
+ __dso__set_long_name_id (dso , name , name_allocated );
1375
1376
dsos -> sorted = false;
1376
1377
up_write (& dsos -> lock );
1378
+ } else {
1379
+ __dso__set_long_name_id (dso , name , name_allocated );
1377
1380
}
1378
1381
}
1379
1382
@@ -1451,6 +1454,16 @@ void dso__set_long_name(struct dso *dso, const char *name, bool name_allocated)
1451
1454
dso__set_long_name_id (dso , name , name_allocated );
1452
1455
}
1453
1456
1457
+ static void __dso__set_short_name (struct dso * dso , const char * name , bool name_allocated )
1458
+ {
1459
+ if (dso__short_name_allocated (dso ))
1460
+ free ((char * )dso__short_name (dso ));
1461
+
1462
+ RC_CHK_ACCESS (dso )-> short_name = name ;
1463
+ RC_CHK_ACCESS (dso )-> short_name_len = strlen (name );
1464
+ dso__set_short_name_allocated (dso , name_allocated );
1465
+ }
1466
+
1454
1467
void dso__set_short_name (struct dso * dso , const char * name , bool name_allocated )
1455
1468
{
1456
1469
struct dsos * dsos = dso__dsos (dso );
@@ -1464,17 +1477,11 @@ void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)
1464
1477
* renaming the dso.
1465
1478
*/
1466
1479
down_write (& dsos -> lock );
1467
- }
1468
- if (dso__short_name_allocated (dso ))
1469
- free ((char * )dso__short_name (dso ));
1470
-
1471
- RC_CHK_ACCESS (dso )-> short_name = name ;
1472
- RC_CHK_ACCESS (dso )-> short_name_len = strlen (name );
1473
- dso__set_short_name_allocated (dso , name_allocated );
1474
-
1475
- if (dsos ) {
1480
+ __dso__set_short_name (dso , name , name_allocated );
1476
1481
dsos -> sorted = false;
1477
1482
up_write (& dsos -> lock );
1483
+ } else {
1484
+ __dso__set_short_name (dso , name , name_allocated );
1478
1485
}
1479
1486
}
1480
1487
0 commit comments