[rtems commit] capture: Fix buffer allocation and free

Sebastian Huber sebh at rtems.org
Thu May 12 11:35:47 UTC 2016


Module:    rtems
Branch:    master
Commit:    2f11d4a0144207321838f746471b56c4cfa40a0d
Changeset: http://git.rtems.org/rtems/commit/?id=2f11d4a0144207321838f746471b56c4cfa40a0d

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu May 12 11:12:27 2016 +0200

capture: Fix buffer allocation and free

Do not use function static variables.  Remove superfluous volatile
qualifiers.  Use proper integer types.

Close #2706.

---

 cpukit/libmisc/capture/capture_buffer.c | 10 +++++-----
 cpukit/libmisc/capture/capture_buffer.h | 12 ++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/cpukit/libmisc/capture/capture_buffer.c b/cpukit/libmisc/capture/capture_buffer.c
index 6f557a9..13e6d1b 100644
--- a/cpukit/libmisc/capture/capture_buffer.c
+++ b/cpukit/libmisc/capture/capture_buffer.c
@@ -28,8 +28,8 @@
 
 void * rtems_capture_buffer_allocate( rtems_capture_buffer_t* buffer, size_t size )
 {
-  static uint32_t   end;
-  static void       *ptr;
+  size_t  end;
+  void   *ptr;
 
   if ( rtems_capture_buffer_is_full( buffer ) )
     return NULL;
@@ -89,9 +89,9 @@ void * rtems_capture_buffer_allocate( rtems_capture_buffer_t* buffer, size_t siz
 
 void *rtems_capture_buffer_free( rtems_capture_buffer_t* buffer, size_t size )
 {
-    static void             *ptr;
-    static uint32_t         next;
-    size_t                  buff_size;
+    void   *ptr;
+    size_t  next;
+    size_t  buff_size;
 
     if (size == 0)
       return NULL;
diff --git a/cpukit/libmisc/capture/capture_buffer.h b/cpukit/libmisc/capture/capture_buffer.h
index ebcc464..2b90b0a 100644
--- a/cpukit/libmisc/capture/capture_buffer.h
+++ b/cpukit/libmisc/capture/capture_buffer.h
@@ -32,12 +32,12 @@ extern "C" {
 #endif
 
 typedef struct {
-  uint8_t           *buffer;
-  size_t            size;
-  volatile uint32_t count;
-  volatile uint32_t head;
-  volatile uint32_t tail;
-  volatile uint32_t end;
+  uint8_t *buffer;
+  size_t   size;
+  size_t   count;
+  size_t   head;
+  size_t   tail;
+  size_t   end;
 } rtems_capture_buffer_t;
 
 static inline void rtems_capture_buffer_flush(  rtems_capture_buffer_t* buffer )



More information about the vc mailing list