diff options
Diffstat (limited to 'cpukit/libcsupport/src/assocptrbyname.c')
-rw-r--r-- | cpukit/libcsupport/src/assocptrbyname.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/assocptrbyname.c b/cpukit/libcsupport/src/assocptrbyname.c new file mode 100644 index 0000000000..457f57e434 --- /dev/null +++ b/cpukit/libcsupport/src/assocptrbyname.c @@ -0,0 +1,35 @@ +/* + * assoc.c + * rtems assoc routines + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#define INSIDE_ASSOC + +#include <rtems.h> +#include <rtems/assoc.h> + +#include <string.h> /* strcat, strcmp */ + + +const rtems_assoc_t *rtems_assoc_ptr_by_name( + const rtems_assoc_t *ap, + const char *name +) +{ + const rtems_assoc_t *default_ap = 0; + + if (rtems_assoc_is_default(ap)) + default_ap = ap++; + + for ( ; ap->name; ap++) + if (strcmp(ap->name, name) == 0) + return ap; + + return default_ap; +} |