4 * Created by Toshi Nagata on 06/03/11.
5 * Copyright 2006-2008 Toshi Nagata. All rights reserved.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation version 2 of the License.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
25 ObjectInit(Object *obj, Object **objRootPtr, const char *name)
28 obj->next = *objRootPtr;
30 ObjectSetName(obj, name, *objRootPtr);
34 ObjectIncrRefCount(Object *obj)
37 return ++(obj->refCount);
42 ObjectDecrRefCount(Object *obj)
45 return --(obj->refCount);
50 ObjectDealloc(Object *obj, Object **objRootPtr)
53 free((void *)(obj->name));
54 for (objp = objRootPtr; *objp != NULL; objp = &((*objp)->next)) {
64 ObjectSetName(Object *obj, const char *name, Object *objRoot)
66 if (obj->name != NULL)
67 free((void *)(obj->name));
68 obj->name = strdup(name);
73 ObjectGetName(Object *obj)
77 else return obj->name;
81 ObjectWithName(const char *name, Object *objRoot)
84 for (obj = objRoot; obj != NULL; obj = obj->next) {
85 if (strcmp(obj->name, name) == 0)