core: Check if the debug_fmt_ops methods are available

In the paste we ass-umed that if cu->dfops != NULL, all the methods would be
there, this ain't so anymore, so check it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-04-02 12:05:50 -03:00
parent 0837979e09
commit 8f14fd6d53
1 changed files with 14 additions and 5 deletions

View File

@ -355,30 +355,39 @@ static inline int tag__is_tag_type(const struct tag *self)
static inline const char *tag__decl_file(const struct tag *self,
const struct cu *cu)
{
return cu->dfops ? cu->dfops->tag__decl_file(self, cu) : NULL;
if (cu->dfops && cu->dfops->tag__decl_file)
return cu->dfops->tag__decl_file(self, cu);
return NULL;
}
static inline uint32_t tag__decl_line(const struct tag *self,
const struct cu *cu)
{
return cu->dfops ? cu->dfops->tag__decl_line(self, cu) : 0;
if (cu->dfops && cu->dfops->tag__decl_line)
return cu->dfops->tag__decl_line(self, cu);
return 0;
}
static inline unsigned long long tag__orig_id(const struct tag *self,
const struct cu *cu)
{
return cu->dfops ? cu->dfops->tag__orig_id(self, cu) : 0;
if (cu->dfops && cu->dfops->tag__orig_id)
return cu->dfops->tag__orig_id(self, cu);
return 0;
}
static inline unsigned long long tag__orig_type(const struct tag *self,
const struct cu *cu)
{
return cu->dfops ? cu->dfops->tag__orig_type(self, cu) : 0;
if (cu->dfops && cu->dfops->tag__orig_type)
return cu->dfops->tag__orig_type(self, cu);
return 0;
}
static inline void tag__free_orig_info(struct tag *self, struct cu *cu)
{
return cu->dfops ? cu->dfops->tag__free_orig_info(self, cu) : 0;
if (cu->dfops && cu->dfops->tag__free_orig_info)
cu->dfops->tag__free_orig_info(self, cu);
}
size_t tag__fprintf_decl_info(const struct tag *self,