LCOV - code coverage report
Current view: top level - pulsecore - packet.c (source / functions) Hit Total Coverage
Test: lcov.out Lines: 0 29 0.0 %
Date: 2012-07-17 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 18 0.0 %

           Branch data     Line data    Source code
       1                 :            : /***
       2                 :            :   This file is part of PulseAudio.
       3                 :            : 
       4                 :            :   Copyright 2004-2006 Lennart Poettering
       5                 :            : 
       6                 :            :   PulseAudio is free software; you can redistribute it and/or modify
       7                 :            :   it under the terms of the GNU Lesser General Public License as
       8                 :            :   published by the Free Software Foundation; either version 2.1 of the
       9                 :            :   License, or (at your option) any later version.
      10                 :            : 
      11                 :            :   PulseAudio is distributed in the hope that it will be useful, but
      12                 :            :   WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      14                 :            :   Lesser General Public License for more details.
      15                 :            : 
      16                 :            :   You should have received a copy of the GNU Lesser General Public
      17                 :            :   License along with PulseAudio; if not, write to the Free Software
      18                 :            :   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
      19                 :            :   USA.
      20                 :            : ***/
      21                 :            : 
      22                 :            : #ifdef HAVE_CONFIG_H
      23                 :            : #include <config.h>
      24                 :            : #endif
      25                 :            : 
      26                 :            : #include <stdlib.h>
      27                 :            : 
      28                 :            : #include <pulse/xmalloc.h>
      29                 :            : #include <pulsecore/macro.h>
      30                 :            : 
      31                 :            : #include "packet.h"
      32                 :            : 
      33                 :          0 : pa_packet* pa_packet_new(size_t length) {
      34                 :            :     pa_packet *p;
      35                 :            : 
      36         [ #  # ]:          0 :     pa_assert(length > 0);
      37                 :            : 
      38                 :          0 :     p = pa_xmalloc(PA_ALIGN(sizeof(pa_packet)) + length);
      39                 :          0 :     PA_REFCNT_INIT(p);
      40                 :          0 :     p->length = length;
      41                 :          0 :     p->data = (uint8_t*) p + PA_ALIGN(sizeof(pa_packet));
      42                 :          0 :     p->type = PA_PACKET_APPENDED;
      43                 :            : 
      44                 :          0 :     return p;
      45                 :            : }
      46                 :            : 
      47                 :          0 : pa_packet* pa_packet_new_dynamic(void* data, size_t length) {
      48                 :            :     pa_packet *p;
      49                 :            : 
      50         [ #  # ]:          0 :     pa_assert(data);
      51         [ #  # ]:          0 :     pa_assert(length > 0);
      52                 :            : 
      53                 :          0 :     p = pa_xnew(pa_packet, 1);
      54                 :          0 :     PA_REFCNT_INIT(p);
      55                 :          0 :     p->length = length;
      56                 :          0 :     p->data = data;
      57                 :          0 :     p->type = PA_PACKET_DYNAMIC;
      58                 :            : 
      59                 :          0 :     return p;
      60                 :            : }
      61                 :            : 
      62                 :          0 : pa_packet* pa_packet_ref(pa_packet *p) {
      63         [ #  # ]:          0 :     pa_assert(p);
      64         [ #  # ]:          0 :     pa_assert(PA_REFCNT_VALUE(p) >= 1);
      65                 :            : 
      66                 :          0 :     PA_REFCNT_INC(p);
      67                 :            :     return p;
      68                 :            : }
      69                 :            : 
      70                 :          0 : void pa_packet_unref(pa_packet *p) {
      71         [ #  # ]:          0 :     pa_assert(p);
      72         [ #  # ]:          0 :     pa_assert(PA_REFCNT_VALUE(p) >= 1);
      73                 :            : 
      74         [ #  # ]:          0 :     if (PA_REFCNT_DEC(p) <= 0) {
      75         [ #  # ]:          0 :         if (p->type == PA_PACKET_DYNAMIC)
      76                 :          0 :             pa_xfree(p->data);
      77                 :          0 :         pa_xfree(p);
      78                 :            :     }
      79                 :          0 : }

Generated by: LCOV version 1.9