evlog - fix "remove setting stack var to 0" that broke evlogs
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Thu, 2 Feb 2017 01:13:24 +0000 (10:13 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Thu, 2 Feb 2017 05:01:10 +0000 (14:01 +0900)
this fixes b38c610c7e60cbdcb45fd6d27450e39e3a9c9dd1 - recent commit by
me. bad me! spank!

src/lib/eina/eina_evlog.c

index 359badb..8c06857 100644 (file)
@@ -128,35 +128,34 @@ EAPI void
 eina_evlog(const char *event, void *obj, double srctime, const char *detail)
 {
    Eina_Evlog_Item *item;
-   int size;
    char *strings;
    double now;
+   int size;
    unsigned short detail_offset, event_size;
 
    if (!_evlog_go) return;
-
-   now        = get_time();
-   event_size = strlen(event) + 1;
-   size       = sizeof(Eina_Evlog_Item) + event_size;
+   now                 = get_time();
+   event_size          = strlen(event) + 1;
+   size                = sizeof(Eina_Evlog_Item) + event_size;
+   detail_offset       = 0;
    if (detail)
      {
         detail_offset  = size;
         size          += strlen(detail) + 1;
      }
-   else detail_offset  = 0;
-   size = sizeof(double) * ((size + sizeof(double) - 1) / sizeof(double));
-
+   size                = sizeof(double) * ((size + sizeof(double) - 1)
+                                           / sizeof(double));
    eina_spinlock_take(&_evlog_lock);
-   strings              = push_buf(buf, size);
-   item                 = (Eina_Evlog_Item *)strings;
-   item->tim            = now;
-   item->srctim         = srctime;
-   item->thread         = (unsigned long long)pthread_self();
-   item->obj            = (unsigned long long)obj;
-   item->event_offset   = sizeof(Eina_Evlog_Item);
-   item->detail_offset  = detail_offset;
-   item->event_next     = size;
-   strcpy(strings + size, event);
+   strings             = push_buf(buf, size);
+   item                = (Eina_Evlog_Item *)strings;
+   item->tim           = now;
+   item->srctim        = srctime;
+   item->thread        = (unsigned long long)pthread_self();
+   item->obj           = (unsigned long long)obj;
+   item->event_offset  = sizeof(Eina_Evlog_Item);
+   item->detail_offset = detail_offset;
+   item->event_next    = size;
+   strcpy(strings + sizeof(Eina_Evlog_Item), event);
    if (detail_offset > 0) strcpy(strings + detail_offset, detail);
    eina_spinlock_release(&_evlog_lock);
 }