[sysprof] perf: let the compiler know our cast is alignment-safe



commit a594d06b0cf3908b31431e9d72b107f3431cfea1
Author: Christian Hergert <christian hergert me>
Date:   Mon Apr 18 18:52:20 2016 -0700

    perf: let the compiler know our cast is alignment-safe
    
    We know everything is 64-bit aligned, so casting via (void*) squashes
    the compiler warning.

 lib/sp-perf-counter.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/sp-perf-counter.c b/lib/sp-perf-counter.c
index 4f1db4b..f08039d 100644
--- a/lib/sp-perf-counter.c
+++ b/lib/sp-perf-counter.c
@@ -247,7 +247,7 @@ sp_perf_counter_flush (SpPerfCounter     *self,
        * which means there will always be space for one header, which means we
        * can safely dereference the size field.
        */
-      header = (struct perf_event_header *)(info->data + (tail & mask));
+      header = (struct perf_event_header *)(gpointer)(info->data + (tail & mask));
 
       if (header->size > head - tail)
         {
@@ -275,7 +275,7 @@ sp_perf_counter_flush (SpPerfCounter     *self,
           memcpy (b, info->data + (tail & mask), n_before);
           memcpy (b + n_before, info->data, n_after);
 
-          header = (struct perf_event_header *)b;
+          header = (struct perf_event_header *)(gpointer)b;
         }
 
       if (header->type == PERF_RECORD_SAMPLE)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]