@@ -333,37 +333,11 @@ static void calculate_version(struct version *version,
333
333
cache_free (& expansion_cache );
334
334
}
335
335
336
- static void __type_expand (struct die * cache , struct type_expansion * type ,
337
- bool recursive );
338
-
339
- static void type_expand_child (struct die * cache , struct type_expansion * type ,
340
- bool recursive )
341
- {
342
- struct type_expansion child ;
343
- char * name ;
344
-
345
- name = get_type_name (cache );
346
- if (!name ) {
347
- __type_expand (cache , type , recursive );
348
- return ;
349
- }
350
-
351
- if (recursive && !__cache_was_expanded (& expansion_cache , cache -> addr )) {
352
- __cache_mark_expanded (& expansion_cache , cache -> addr );
353
- type_expansion_init (& child );
354
- __type_expand (cache , & child , true);
355
- type_map_add (name , & child );
356
- type_expansion_free (& child );
357
- }
358
-
359
- type_expansion_append (type , name , name );
360
- }
361
-
362
- static void __type_expand (struct die * cache , struct type_expansion * type ,
363
- bool recursive )
336
+ static void __type_expand (struct die * cache , struct type_expansion * type )
364
337
{
365
338
struct die_fragment * df ;
366
339
struct die * child ;
340
+ char * name ;
367
341
368
342
list_for_each_entry (df , & cache -> fragments , list ) {
369
343
switch (df -> type ) {
@@ -379,7 +353,12 @@ static void __type_expand(struct die *cache, struct type_expansion *type,
379
353
error ("unknown child: %" PRIxPTR ,
380
354
df -> data .addr );
381
355
382
- type_expand_child (child , type , recursive );
356
+ name = get_type_name (child );
357
+ if (name )
358
+ type_expansion_append (type , name , name );
359
+ else
360
+ __type_expand (child , type );
361
+
383
362
break ;
384
363
case FRAGMENT_LINEBREAK :
385
364
/*
@@ -397,12 +376,17 @@ static void __type_expand(struct die *cache, struct type_expansion *type,
397
376
}
398
377
}
399
378
400
- static void type_expand (struct die * cache , struct type_expansion * type ,
401
- bool recursive )
379
+ static void type_expand (const char * name , struct die * cache ,
380
+ struct type_expansion * type )
402
381
{
382
+ const char * override ;
383
+
403
384
type_expansion_init (type );
404
- __type_expand (cache , type , recursive );
405
- cache_free (& expansion_cache );
385
+
386
+ if (stable && kabi_get_type_string (name , & override ))
387
+ type_parse (name , override , type );
388
+ else
389
+ __type_expand (cache , type );
406
390
}
407
391
408
392
static void type_parse (const char * name , const char * str ,
@@ -416,8 +400,6 @@ static void type_parse(const char *name, const char *str,
416
400
if (!* str )
417
401
error ("empty type string override for '%s'" , name );
418
402
419
- type_expansion_init (type );
420
-
421
403
for (pos = 0 ; str [pos ]; ++ pos ) {
422
404
bool empty ;
423
405
char marker = ' ' ;
@@ -478,7 +460,6 @@ static void type_parse(const char *name, const char *str,
478
460
static void expand_type (struct die * cache , void * arg )
479
461
{
480
462
struct type_expansion type ;
481
- const char * override ;
482
463
char * name ;
483
464
484
465
if (cache -> mapped )
@@ -504,11 +485,7 @@ static void expand_type(struct die *cache, void *arg)
504
485
505
486
debug ("%s" , name );
506
487
507
- if (stable && kabi_get_type_string (name , & override ))
508
- type_parse (name , override , & type );
509
- else
510
- type_expand (cache , & type , true);
511
-
488
+ type_expand (name , cache , & type );
512
489
type_map_add (name , & type );
513
490
type_expansion_free (& type );
514
491
free (name );
@@ -518,7 +495,6 @@ static void expand_symbol(struct symbol *sym, void *arg)
518
495
{
519
496
struct type_expansion type ;
520
497
struct version version ;
521
- const char * override ;
522
498
struct die * cache ;
523
499
524
500
/*
@@ -532,10 +508,7 @@ static void expand_symbol(struct symbol *sym, void *arg)
532
508
if (__die_map_get (sym -> die_addr , DIE_SYMBOL , & cache ))
533
509
return ; /* We'll warn about missing CRCs later. */
534
510
535
- if (stable && kabi_get_type_string (sym -> name , & override ))
536
- type_parse (sym -> name , override , & type );
537
- else
538
- type_expand (cache , & type , false);
511
+ type_expand (sym -> name , cache , & type );
539
512
540
513
/* If the symbol already has a version, don't calculate it again. */
541
514
if (sym -> state != SYMBOL_PROCESSED ) {
0 commit comments