[LIB]: Make tag__fprintf return the number of bytes printed

For consistency with all the other __fprintf routines.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-02-15 12:03:47 -02:00
parent c3103abfef
commit 5a420cc24e
2 changed files with 21 additions and 19 deletions

View File

@ -2665,40 +2665,42 @@ static size_t variable__fprintf(const struct tag *tag, const struct cu *cu,
return n;
}
void tag__fprintf(const struct tag *self, const struct cu *cu,
const char *prefix, const char *suffix,
uint8_t expand_types, FILE *fp)
size_t tag__fprintf(const struct tag *self, const struct cu *cu,
const char *prefix, const char *suffix,
uint8_t expand_types, FILE *fp)
{
tag__fprintf_decl_info(self, fp);
size_t printed = tag__fprintf_decl_info(self, fp);
switch (self->tag) {
case DW_TAG_enumeration_type:
enumeration__fprintf(self, suffix, 0, fp);
printed += enumeration__fprintf(self, suffix, 0, fp);
break;
case DW_TAG_typedef:
typedef__fprintf(self, cu, fp);
printed += typedef__fprintf(self, cu, fp);
break;
case DW_TAG_structure_type:
class__fprintf(tag__class(self), cu, prefix, suffix,
expand_types, 0, 26, expand_types ? 55 : 23, 1,
fp);
printed += class__fprintf(tag__class(self), cu, prefix, suffix,
expand_types, 0, 26,
expand_types ? 55 : 23, 1, fp);
break;
case DW_TAG_subprogram:
function__fprintf(self, cu, fp);
printed += function__fprintf(self, cu, fp);
break;
case DW_TAG_union_type:
union__fprintf(tag__type(self), cu, prefix, suffix,
expand_types, 0,
26, expand_types ? 55 : 21, fp);
printed += union__fprintf(tag__type(self), cu, prefix, suffix,
expand_types, 0, 26,
expand_types ? 55 : 21, fp);
break;
case DW_TAG_variable:
variable__fprintf(self, cu, expand_types, fp);
printed += variable__fprintf(self, cu, expand_types, fp);
break;
default:
fprintf(fp, "%s: %s tag not supported!\n", __func__,
dwarf_tag_name(self->tag));
printed += fprintf(fp, "%s: %s tag not supported!\n", __func__,
dwarf_tag_name(self->tag));
break;
}
return printed;
}
int cu__for_each_tag(struct cu *self,

View File

@ -271,9 +271,9 @@ extern size_t class__fprintf(const struct class *self, const struct cu *cu,
uint8_t expand_types, uint8_t indent,
size_t type_spacing, size_t name_spacing,
int emit_stats, FILE *fp);
extern void tag__fprintf(const struct tag *self, const struct cu *cu,
const char *prefix, const char *suffix,
uint8_t expand_types, FILE *fp);
extern size_t tag__fprintf(const struct tag *self, const struct cu *cu,
const char *prefix, const char *suffix,
uint8_t expand_types, FILE *fp);
extern const char *function__name(struct function *self, const struct cu *cu);
extern size_t function__fprintf_stats(const struct tag *tag_self,