Changeset 02733495 in rtems


Ignore:
Timestamp:
11/24/14 14:20:25 (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
42fe0d3
Parents:
46689a1e
git-author:
Sebastian Huber <sebastian.huber@…> (11/24/14 14:20:25)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/25/14 15:08:16)
Message:

libcsupport: malloc_is_system_state_OK()

Move system state check to malloc_is_system_state_OK().

Location:
cpukit/libcsupport/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/free.c

    r46689a1e r02733495  
    3737   *  Do not attempt to free memory if in a critical section or ISR.
    3838   */
    39   if ( _System_state_Is_up(_System_state_Get()) &&
    40        !malloc_is_system_state_OK() ) {
     39  if ( !malloc_is_system_state_OK() ) {
    4140      malloc_deferred_free(ptr);
    4241      return;
  • cpukit/libcsupport/src/malloc.c

    r46689a1e r02733495  
    2525#include "malloc_p.h"
    2626
    27 #include <rtems/score/sysstate.h>
    28 
    2927void *malloc(
    3028  size_t  size
     
    4947   *  Do not attempt to allocate memory if not in correct system state.
    5048   */
    51   if ( _System_state_Is_up(_System_state_Get()) &&
    52        !malloc_is_system_state_OK() )
     49  if ( !malloc_is_system_state_OK() )
    5350    return NULL;
    5451
  • cpukit/libcsupport/src/malloc_deferred.c

    r46689a1e r02733495  
    2828#include "malloc_p.h"
    2929
     30#include <rtems/score/sysstate.h>
    3031#include <rtems/score/threaddispatch.h>
    3132
     
    3435bool malloc_is_system_state_OK(void)
    3536{
    36   if ( !_Thread_Dispatch_is_enabled() )
    37     return false;
    38 
    39   return true;
     37  return !_System_state_Is_up( _System_state_Get() )
     38    || _Thread_Dispatch_is_enabled();
    4039}
    4140
  • cpukit/libcsupport/src/rtems_malloc.c

    r46689a1e r02733495  
    2727#include "malloc_p.h"
    2828
    29 #include <rtems/score/sysstate.h>
    30 
    3129void *rtems_heap_allocate_aligned_with_boundary(
    3230  size_t size,
     
    3533)
    3634{
    37   if (
    38     _System_state_Is_up( _System_state_Get() )
    39       && !malloc_is_system_state_OK()
    40   ) {
     35  if ( !malloc_is_system_state_OK() ) {
    4136    return NULL;
    4237  }
  • cpukit/libcsupport/src/rtems_memalign.c

    r46689a1e r02733495  
    2525#include <errno.h>
    2626
    27 #include <rtems/score/sysstate.h>
    28 
    2927int rtems_memalign(
    3028  void   **pointer,
     
    4644   *  Do not attempt to allocate memory if not in correct system state.
    4745   */
    48   if ( _System_state_Is_up(_System_state_Get()) &&
    49        !malloc_is_system_state_OK() )
     46  if ( !malloc_is_system_state_OK() )
    5047    return EINVAL;
    5148
Note: See TracChangeset for help on using the changeset viewer.