LCOV - code coverage report
Current view: top level - src - ppg_event_buffer.c (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 10 10 100.0 %
Date: 2018-01-08 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* Copyright 2017 noseglasses <shinynoseglasses@gmail.com>
       2             :  *
       3             :  * This program is free software: you can redistribute it and/or modify
       4             :  * it under the terms of the GNU Lesser General Public License as published by
       5             :  * the Free Software Foundation, either version 3 of the License, or
       6             :  * (at your option) any later version.
       7             :  *
       8             :  * This program is distributed in the hope that it will be useful,
       9             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      10             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      11             :  * GNU Lesser General Public License for more details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
      15             :  */
      16             : 
      17             : #include "ppg_event_buffer.h"
      18             : #include "detail/ppg_event_buffer_detail.h"
      19             : #include "detail/ppg_context_detail.h"
      20             : #include "ppg_debug.h"
      21             : 
      22             : typedef struct {
      23             :    PPG_Event_Processor_Fun fun;
      24             :    void *user_data;
      25             : } PPG_Event_Buffer_Visitor_Adaptor_Data;
      26             : 
      27         285 : static void ppg_event_buffer_visit_adaptor(PPG_Event_Queue_Entry *eqe,
      28             :                         void *user_data)
      29             : {
      30         285 :    PPG_Event_Buffer_Visitor_Adaptor_Data *adaptor_data
      31             :       = (PPG_Event_Buffer_Visitor_Adaptor_Data*)user_data;
      32             :       
      33         285 :    PPG_ASSERT(adaptor_data);
      34         285 :    PPG_ASSERT(adaptor_data->fun);
      35             :    
      36         285 :    adaptor_data->fun(&eqe->event, adaptor_data->user_data);
      37         285 : }
      38             : 
      39         474 : void ppg_event_buffer_iterate(
      40             :                         PPG_Event_Processor_Fun event_processor,
      41             :                         void *user_data)
      42             : {
      43         474 :    PPG_Event_Buffer_Visitor_Adaptor_Data adaptor_data =
      44             :       { 
      45             :          .fun = event_processor,
      46             :          .user_data = user_data
      47             :       };
      48             :       
      49         474 :    ppg_event_buffer_iterate2(
      50             :       (PPG_Event_Processor_Visitor)ppg_event_buffer_visit_adaptor,
      51             :       &adaptor_data
      52             :    );
      53         474 : }

Generated by: LCOV version 1.10