From 8f14fd6d53d5ecce036df297e8bf6c4ef9dd3d5a Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 2 Apr 2009 12:05:50 -0300 Subject: [PATCH] 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 --- dwarves.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dwarves.h b/dwarves.h index 19d811a..2f4fcf2 100644 --- a/dwarves.h +++ b/dwarves.h @@ -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,