source: rtems/cpukit/score/src/objectnametoidstring.c @ 16d7b65

4.115
Last change on this file since 16d7b65 was 16d7b65, checked in by Joel Sherrill <joel.sherrill@…>, on 11/16/10 at 17:50:26

2010-11-16 Joel Sherrill <joel.sherrill@…>

  • score/src/objectnametoid.c, score/src/objectnametoidstring.c: Remove useless variable pointed out by clang.
  • score/src/threadstackallocate.c: Remove useless variable initialization pointed out by clang.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Object Handler - Object ID to Name (String)
3 *
4 *  COPYRIGHT (c) 1989-2010.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <string.h>
19
20#include <rtems/system.h>
21#include <rtems/score/address.h>
22#include <rtems/score/chain.h>
23#include <rtems/score/object.h>
24#if defined(RTEMS_MULTIPROCESSING)
25#include <rtems/score/objectmp.h>
26#endif
27#include <rtems/score/thread.h>
28#include <rtems/score/wkspace.h>
29#include <rtems/score/sysstate.h>
30#include <rtems/score/isr.h>
31
32#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
33/*PAGE
34 *
35 *  _Objects_Name_to_id_string
36 *
37 *  These kernel routines search the object table(s) for the given
38 *  object name and returns the associated object id.
39 *
40 *  Input parameters:
41 *    information - object information
42 *    name        - user defined object name
43 *    id          - address of return ID
44 *
45 *  Output parameters:
46 *    id                                   - object id
47 *    OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL - if successful
48 *    error code                           - if unsuccessful
49 */
50
51Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
52  Objects_Information *information,
53  const char          *name,
54  Objects_Id          *id
55)
56{
57  Objects_Control           *the_object;
58  uint32_t                   index;
59
60  /* ASSERT: information->is_string == true */
61
62  if ( !id )
63    return OBJECTS_INVALID_ADDRESS;
64
65  if ( !name )
66    return OBJECTS_INVALID_NAME;
67
68  if ( information->maximum != 0 ) {
69
70    for ( index = 1; index <= information->maximum; index++ ) {
71      the_object = information->local_table[ index ];
72      if ( !the_object )
73        continue;
74
75      if ( !the_object->name.name_p )
76        continue;
77
78      if (!strncmp( name, the_object->name.name_p, information->name_length)) {
79        *id = the_object->id;
80        return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
81      }
82    }
83  }
84
85  return OBJECTS_INVALID_NAME;
86}
87#endif
Note: See TracBrowser for help on using the repository browser.