1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | #if HAVE_CONFIG_H1 |
16 | #include "config.h" |
17 | #endif |
18 | |
19 | #include <string.h> |
20 | |
21 | #include <rtems/system.h> |
22 | #include <rtems/score/address.h> |
23 | #include <rtems/score/chain.h> |
24 | #include <rtems/score/object.h> |
25 | #if defined(RTEMS_MULTIPROCESSING) |
26 | #include <rtems/score/objectmp.h> |
27 | #endif |
28 | #include <rtems/score/thread.h> |
29 | #include <rtems/score/wkspace.h> |
30 | #include <rtems/score/sysstate.h> |
31 | #include <rtems/score/isr.h> |
32 | |
33 | #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES) |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string( |
53 | Objects_Information *information, |
54 | const char *name, |
55 | Objects_Id *id |
56 | ) |
57 | { |
58 | Objects_Control *the_object; |
59 | uint32_t index; |
60 | uint32_t name_length; |
61 | |
62 | |
63 | |
64 | if ( !id ) |
65 | return OBJECTS_INVALID_ADDRESS; |
66 | |
67 | if ( !name ) |
68 | return OBJECTS_INVALID_NAME; |
69 | |
70 | if ( information->maximum != 0 ) { |
71 | name_length = information->name_length; |
| Value stored to 'name_length' is never read |
72 | |
73 | for ( index = 1; index <= information->maximum; index++ ) { |
74 | the_object = information->local_table[ index ]; |
75 | if ( !the_object ) |
76 | continue; |
77 | |
78 | if ( !the_object->name.name_p ) |
79 | continue; |
80 | |
81 | if (!strncmp( name, the_object->name.name_p, information->name_length)) { |
82 | *id = the_object->id; |
83 | return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; |
84 | } |
85 | } |
86 | } |
87 | |
88 | return OBJECTS_INVALID_NAME; |
89 | } |
90 | #endif |