source: rtems/cpukit/score/src/objectgetnext.c @ bbd6d27a

5
Last change on this file since bbd6d27a was 572cb624, checked in by Sebastian Huber <sebastian.huber@…>, on 04/07/16 at 14:48:30

score: Simplify _Objects_Get_no_protection()

This functions supports only local objects. Thus, drop the location
parameter which was unused by all callers.

Remove superfluous includes from Classic Region implementation.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief Get Pointer to Next Object that is Active
5 * @ingroup ScoreObject
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-1999.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/objectimpl.h>
22
23Objects_Control *
24_Objects_Get_next(
25    Objects_Information *information,
26    Objects_Id           id,
27    Objects_Locations   *location_p,
28    Objects_Id          *next_id_p
29)
30{
31    Objects_Control *the_object;
32    Objects_Id       next_id;
33
34    if ( !information )
35      return NULL;
36
37    if ( !location_p )
38      return NULL;
39
40    if ( !next_id_p )
41      return NULL;
42
43    if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX)
44        next_id = information->minimum_id;
45    else
46        next_id = id;
47
48    _Objects_Allocator_lock();
49
50    do {
51        /* walked off end of list? */
52        if (_Objects_Get_index(next_id) > information->maximum)
53        {
54            _Objects_Allocator_unlock();
55            *location_p = OBJECTS_ERROR;
56            *next_id_p = OBJECTS_ID_FINAL;
57            return NULL;
58        }
59
60        /* try to grab one */
61        the_object = _Objects_Get_no_protection( information, next_id );
62
63        next_id++;
64
65    } while ( the_object == NULL );
66
67    *location_p = OBJECTS_LOCAL;
68    *next_id_p = next_id;
69    return the_object;
70}
Note: See TracBrowser for help on using the repository browser.