From c372555a6ca6293e711041887a1734a1ea38d6ce Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 20 Dec 2006 14:02:05 -0200 Subject: [PATCH] [CLASSES]: Return NULL in cu__find_class_by_id if tag.type == 0 I.e. if the type is void, avoiding looking the whole list for something that is not there. Signed-off-by: Arnaldo Carvalho de Melo --- classes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes.c b/classes.c index ff9c547..1d6a131 100644 --- a/classes.c +++ b/classes.c @@ -273,6 +273,9 @@ struct class *cu__find_class_by_id(const struct cu *self, const uint64_t id) { struct class *pos; + if (id == 0) + return NULL; + list_for_each_entry(pos, &self->classes, tag.node) if (pos->tag.id == id) return pos;