Patchwork [4/4] trace/simple.c: minor code refactoring

login
register
mail settings
Submitter Harsh Prateek Bora
Date July 20, 2012, 1:22 p.m.
Message ID <1342790535-11444-5-git-send-email-harsh@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/172270/
State New
Headers show

Comments

Harsh Prateek Bora - July 20, 2012, 1:22 p.m.
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
---
 trace/simple.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Patch

diff --git a/trace/simple.c b/trace/simple.c
index 4fed07f..8e175ec 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -269,12 +269,11 @@  static unsigned int write_to_buffer(unsigned int idx, void *dataptr, size_t size
 
 void trace_record_finish(TraceBufferRecord *rec)
 {
-    uint8_t temp_rec[sizeof(TraceRecord)];
-    TraceRecord *record = (TraceRecord *) temp_rec;
-    read_from_buffer(rec->tbuf_idx, temp_rec, sizeof(TraceRecord));
+    TraceRecord record;
+    read_from_buffer(rec->tbuf_idx, &record, sizeof(TraceRecord));
     smp_wmb(); /* write barrier before marking as valid */
-    record->event |= TRACE_RECORD_VALID;
-    write_to_buffer(rec->tbuf_idx, temp_rec, sizeof(TraceRecord));
+    record.event |= TRACE_RECORD_VALID;
+    write_to_buffer(rec->tbuf_idx, &record, sizeof(TraceRecord));
 
     if ((trace_idx - writeout_idx) > TRACE_BUF_FLUSH_THRESHOLD) {
         flush_trace_file(false);