# Use consistent behaviour loading classes in AddUSBClasses & Trident prefs.
[AROS.git] / rom / utility / intfindnamedobj.c
blobd25f212443594e8586409d0f32f67f0143967ef8
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Find a NamedObject in a NameSpace.
6 Lang: English
8 --------------------------------------------------------------------
10 This function will start searching through a sublist of NamedObjects
11 looking for the node which has the correct name (case insensitive).
12 Case sensitive searches are done with FindName().
16 #include "intern.h"
17 #include <proto/exec.h>
18 #include <proto/utility.h>
20 struct IntNamedObject *
21 IntFindNamedObj(struct NameSpace *ns,
22 struct Node *start,
23 CONST_STRPTR name,
24 struct UtilityBase *UtilityBase)
26 struct IntNamedObject *no = NULL;
28 if((ns->ns_Flags & NSF_CASE))
30 no = (struct IntNamedObject *)
31 FindName((struct List *)start->ln_Pred, name);
33 else
35 /* We are at the end of the list when ln_Succ == NULL */
36 while(start->ln_Succ != NULL)
38 if(!Stricmp(name, start->ln_Name))
41 We have found the node we are after.
42 Note, we actually get the correct address
43 later.
45 no = (struct IntNamedObject *)start;
47 start = start->ln_Succ;
52 This is safe, since the Node occurs just after the public
53 part of the NamedObject, which is what we return.
55 if(no)
56 return (struct IntNamedObject *)((struct NamedObject *)no - 1);
57 else
58 return NULL;