From 65357c8c46154de4e4eca14075bfe5523bb5fc14 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 7 Dec 2020 10:26:01 +0100 Subject: New upstream version 3.0.3 --- Object.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'Object.c') diff --git a/Object.c b/Object.c index 4d8045d..0a29d01 100644 --- a/Object.c +++ b/Object.c @@ -2,28 +2,32 @@ htop - Object.c (C) 2004-2012 Hisham H. Muhammad (C) 2020 Red Hat, Inc. All Rights Reserved. -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ #include "Object.h" -ObjectClass Object_class = { +#include + + +const ObjectClass Object_class = { .extends = NULL }; -#ifdef DEBUG +#ifndef NDEBUG -bool Object_isA(Object* o, const ObjectClass* klass) { +bool Object_isA(const Object* o, const ObjectClass* klass) { if (!o) return false; - const ObjectClass* type = o->klass; - while (type) { - if (type == klass) + + for (const ObjectClass* type = o->klass; type; type = type->extends) { + if (type == klass) { return true; - type = type->extends; + } } + return false; } -#endif +#endif /* NDEBUG */ -- cgit v1.2.3