2006-03-04 18:16:49 +00:00
|
|
|
/*
|
2011-12-26 21:35:57 +00:00
|
|
|
htop - Object.c
|
2012-12-05 15:12:20 +00:00
|
|
|
(C) 2004-2012 Hisham H. Muhammad
|
2020-08-19 23:35:24 +00:00
|
|
|
(C) 2020 Red Hat, Inc. All Rights Reserved.
|
2020-10-05 07:51:32 +00:00
|
|
|
Released under the GNU GPLv2, see the COPYING file
|
2006-03-04 18:16:49 +00:00
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "Object.h"
|
2011-12-26 21:35:57 +00:00
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
2020-10-04 15:55:08 +00:00
|
|
|
const ObjectClass Object_class = {
|
2012-12-05 15:12:20 +00:00
|
|
|
.extends = NULL
|
|
|
|
};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-17 20:27:33 +00:00
|
|
|
#ifndef NDEBUG
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-10-05 10:27:32 +00:00
|
|
|
bool Object_isA(const Object* o, const ObjectClass* klass) {
|
2012-12-05 15:12:20 +00:00
|
|
|
if (!o)
|
|
|
|
return false;
|
2020-11-01 00:09:51 +00:00
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
const ObjectClass* type = o->klass;
|
|
|
|
while (type) {
|
2020-11-01 00:09:51 +00:00
|
|
|
if (type == klass) {
|
2012-12-05 15:12:20 +00:00
|
|
|
return true;
|
2020-11-01 00:09:51 +00:00
|
|
|
}
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
type = type->extends;
|
|
|
|
}
|
2020-11-01 00:09:51 +00:00
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
return false;
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
2020-09-17 20:27:33 +00:00
|
|
|
#endif /* NDEBUG */
|