[LIB]: Fix stupid if + switch case

Where the 'if' should be just one of of the cases in the 'switch', and guess
what:

This:

  diff --git a/dwarves.c b/dwarves.c
  index c0ae7c8..34f29a1 100644
  --- a/dwarves.c
  +++ b/dwarves.c
  @@ -2580,10 +2580,10 @@ static int cus__emit_typedef_definitions
   	}
   	type = cu__find_tag_by_id(cu, tdef->type);

  -	if (type->tag == DW_TAG_typedef)
  -		cus__emit_typedef_definitions(self, cu, type);
  -
   	switch (type->tag) {
  +	case DW_TAG_typedef:
  +		cus__emit_typedef_definitions(self, cu, type);
  +		break;
   	case DW_TAG_pointer_type:
   		ptr_type = cu__find_tag_by_id(cu, type->type);
   		if (ptr_type->tag != DW_TAG_subroutine_type)

Results in this:

[acme@newtoy pahole]$ codiff -V build/libdwarves.so.orig build/libdwarves.so
/home/acme/pahole/dwarves.c:
  cus__emit_typedef_definitions |  -18 # 466 -> 448
 1 function changed, 18 bytes removed
[acme@newtoy pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-01-13 16:22:53 -02:00
parent 9b0f2584fe
commit 9a413e60a3
1 changed files with 3 additions and 3 deletions

View File

@ -2580,10 +2580,10 @@ static int cus__emit_typedef_definitions(struct cus *self, struct cu *cu,
}
type = cu__find_tag_by_id(cu, tdef->type);
if (type->tag == DW_TAG_typedef)
cus__emit_typedef_definitions(self, cu, type);
switch (type->tag) {
case DW_TAG_typedef:
cus__emit_typedef_definitions(self, cu, type);
break;
case DW_TAG_pointer_type:
ptr_type = cu__find_tag_by_id(cu, type->type);
if (ptr_type->tag != DW_TAG_subroutine_type)