1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PipeWire: array.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">PipeWire
 <span id="projectnumber">0.2.9</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('array_8h_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">array.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="array_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/* PipeWire</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> *</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * Copyright © 2018 Wim Taymans</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> *</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * copy of this software and associated documentation files (the "Software"),</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * to deal in the Software without restriction, including without limitation</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * Software is furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> *</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * The above copyright notice and this permission notice (including the next</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * paragraph) shall be included in all copies or substantial portions of the</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * Software.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> *</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * DEALINGS IN THE SOFTWARE.</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> */</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#ifndef PIPEWIRE_ARRAY_H</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#define PIPEWIRE_ARRAY_H</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#include <errno.h></span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#include <spa/utils/defs.h></span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structpw__array.html"> 43</a></span> <span class="keyword">struct </span><a class="code" href="structpw__array.html">pw_array</a> {</div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5"> 44</a></span>  <span class="keywordtype">void</span> *<a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a>; </div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b"> 45</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a>; </div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="structpw__array.html#a429b934f5c1580d91af238ac04e44842"> 46</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structpw__array.html#a429b934f5c1580d91af238ac04e44842">alloc</a>; </div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structpw__array.html#a92ae2df32c3d6935897f41b6e7f5ad3c"> 47</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structpw__array.html#a92ae2df32c3d6935897f41b6e7f5ad3c">extend</a>; </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> };</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> </div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="array_8h.html#a20b2d5c76f5bd422da680284e2709164"> 50</a></span> <span class="preprocessor">#define PW_ARRAY_INIT(extend) (struct pw_array) { NULL, 0, 0, extend }</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> </div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="array_8h.html#aedd836346a7503ad9b55f6db1135c7eb"> 52</a></span> <span class="preprocessor">#define pw_array_get_len_s(a,s) ((a)->size / (s))</span></div><div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="array_8h.html#a9bf5018e1a0d7466dc4fcac3e3207939"> 53</a></span> <span class="preprocessor">#define pw_array_get_unchecked_s(a,idx,s,t) SPA_MEMBER((a)->data,(idx)*(s),t)</span></div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="array_8h.html#a47a9004f4bdadccc2f702b83c16e468d"> 54</a></span> <span class="preprocessor">#define pw_array_check_index_s(a,idx,s) ((idx) < pw_array_get_len_s(a,s))</span></div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> </div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structpw__array.html#adc116ecc65a6fb6f1d207e64c167c6b3"> 57</a></span> <span class="preprocessor">#define pw_array_get_len(a,t) pw_array_get_len_s(a,sizeof(t))</span></div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structpw__array.html#ab0a7f1be44fce5380425b1ffcc674cf2"> 59</a></span> <span class="preprocessor">#define pw_array_get_unchecked(a,idx,t) pw_array_get_unchecked_s(a,idx,sizeof(t),t)</span></div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="structpw__array.html#a0cfa9d60080b10e5256fb90979199132"> 61</a></span> <span class="preprocessor">#define pw_array_check_index(a,idx,t) pw_array_check_index_s(a,idx,sizeof(t))</span></div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="array_8h.html#a85440beb42b600e73e18daa0f3733f18"> 63</a></span> <span class="preprocessor">#define pw_array_first(a) ((a)->data)</span></div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="array_8h.html#ae9cb8580392ca2b9f97868eb9931968a"> 64</a></span> <span class="preprocessor">#define pw_array_end(a) SPA_MEMBER((a)->data, (a)->size, void)</span></div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="array_8h.html#a2625032cf701f2e966cbebec6b960596"> 65</a></span> <span class="preprocessor">#define pw_array_check(a,p) (SPA_MEMBER(p,sizeof(*p),void) <= pw_array_end(a))</span></div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="array_8h.html#aa960ca693013e1b7fce13b0968db70b8"> 67</a></span> <span class="preprocessor">#define pw_array_for_each(pos, array) \</span></div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> <span class="preprocessor"> for (pos = (__typeof__(pos)) pw_array_first(array); \</span></div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> <span class="preprocessor"> pw_array_check(array, pos); \</span></div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> <span class="preprocessor"> (pos)++)</span></div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="array_8h.html#a7acbb5b8fe524379b21e6eb8b9958aeb"> 72</a></span> <span class="preprocessor">#define pw_array_remove(a,p) \</span></div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="preprocessor"> (a)->size -= sizeof(*(p)); \</span></div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> <span class="preprocessor"> memmove(p, SPA_MEMBER((p), sizeof(*(p)), void), \</span></div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> <span class="preprocessor"> SPA_PTRDIFF(pw_array_end(a),(p)));</span></div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> </div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="structpw__array.html#a41905dd179bcee03cceef47579e0a22e"> 79</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structpw__array.html#a41905dd179bcee03cceef47579e0a22e">pw_array_init</a>(<span class="keyword">struct</span> <a class="code" href="structpw__array.html">pw_array</a> *arr, <span class="keywordtype">size_t</span> extend)</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  arr-><a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a> = NULL;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  arr-><a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a> = arr-><a class="code" href="structpw__array.html#a429b934f5c1580d91af238ac04e44842">alloc</a> = 0;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  arr-><a class="code" href="structpw__array.html#a92ae2df32c3d6935897f41b6e7f5ad3c">extend</a> = extend;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> }</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> pw_array_clear(<span class="keyword">struct</span> <a class="code" href="structpw__array.html">pw_array</a> *arr)</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> {</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  free(arr-><a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a>);</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> }</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> pw_array_reset(<span class="keyword">struct</span> <a class="code" href="structpw__array.html">pw_array</a> *arr)</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> {</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  arr-><a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a> = 0;</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> }</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div><div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="structpw__array.html#a3045d41af637079f6cba71102050f119"> 99</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="structpw__array.html#a3045d41af637079f6cba71102050f119">pw_array_ensure_size</a>(<span class="keyword">struct</span> <a class="code" href="structpw__array.html">pw_array</a> *arr, <span class="keywordtype">size_t</span> size)</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> {</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordtype">size_t</span> alloc, need;</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> </div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  alloc = arr-><a class="code" href="structpw__array.html#a429b934f5c1580d91af238ac04e44842">alloc</a>;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  need = arr-><a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a> + size;</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> </div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">if</span> (SPA_UNLIKELY(alloc < need)) {</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordtype">void</span> *<a class="code" href="structdata.html">data</a>;</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  alloc = SPA_MAX(alloc, arr-><a class="code" href="structpw__array.html#a92ae2df32c3d6935897f41b6e7f5ad3c">extend</a>);</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordflow">while</span> (alloc < need)</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  alloc *= 2;</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">if</span> (SPA_UNLIKELY((<a class="code" href="structdata.html">data</a> = realloc(arr-><a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a>, alloc)) == NULL))</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordflow">return</span> -errno;</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  arr-><a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a> = <a class="code" href="structdata.html">data</a>;</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  arr-><a class="code" href="structpw__array.html#a429b934f5c1580d91af238ac04e44842">alloc</a> = alloc;</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  }</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span> }</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div><div class="line"><a name="l00121"></a><span class="lineno"><a class="line" href="structpw__array.html#adf6a4fd9f9bd810eb374737b3d1169b2"> 121</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> *<a class="code" href="structpw__array.html#adf6a4fd9f9bd810eb374737b3d1169b2">pw_array_add</a>(<span class="keyword">struct</span> <a class="code" href="structpw__array.html">pw_array</a> *arr, <span class="keywordtype">size_t</span> size)</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> {</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordtype">void</span> *p;</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> </div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keywordflow">if</span> (<a class="code" href="structpw__array.html#a3045d41af637079f6cba71102050f119">pw_array_ensure_size</a>(arr, size) < 0)</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> </div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  p = SPA_MEMBER(arr-><a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a>, arr-><a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a>, <span class="keywordtype">void</span>);</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  arr-><a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a> += size;</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> </div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="keywordflow">return</span> p;</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span> }</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> </div><div class="line"><a name="l00136"></a><span class="lineno"><a class="line" href="structpw__array.html#ae8d9a82b23a44ceb033f7f6ce3b0621d"> 136</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> *<a class="code" href="structpw__array.html#ae8d9a82b23a44ceb033f7f6ce3b0621d">pw_array_add_fixed</a>(<span class="keyword">struct</span> <a class="code" href="structpw__array.html">pw_array</a> *arr, <span class="keywordtype">size_t</span> size)</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> {</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordtype">void</span> *p;</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> </div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keywordflow">if</span> (SPA_UNLIKELY(arr-><a class="code" href="structpw__array.html#a429b934f5c1580d91af238ac04e44842">alloc</a> < arr-><a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a> + size)) {</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  errno = ENOSPC;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  }</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> </div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  p = SPA_MEMBER(arr-><a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a>, arr-><a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a>, <span class="keywordtype">void</span>);</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  arr-><a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a> += size;</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> </div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="keywordflow">return</span> p;</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span> }</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div><div class="line"><a name="l00152"></a><span class="lineno"><a class="line" href="structpw__array.html#a8d035221a3657cf9d2ede737a62a7c77"> 152</a></span> <span class="preprocessor">#define pw_array_add_ptr(a,p) \</span></div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="preprocessor"> *((void**) pw_array_add(a, sizeof(void*))) = (p)</span></div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span> </div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> } <span class="comment">/* extern "C" */</span></div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span> <span class="preprocessor">#endif </span><span class="comment">/* PIPEWIRE_ARRAY_H */</span><span class="preprocessor"></span></div><div class="ttc" id="structpw__array_html_a3045d41af637079f6cba71102050f119"><div class="ttname"><a href="structpw__array.html#a3045d41af637079f6cba71102050f119">pw_array::pw_array_ensure_size</a></div><div class="ttdeci">static int pw_array_ensure_size(struct pw_array *arr, size_t size)</div><div class="ttdoc">Make sure size bytes can be added to the array.</div><div class="ttdef"><b>Definition:</b> array.h:99</div></div>
<div class="ttc" id="structpw__array_html_adf6a4fd9f9bd810eb374737b3d1169b2"><div class="ttname"><a href="structpw__array.html#adf6a4fd9f9bd810eb374737b3d1169b2">pw_array::pw_array_add</a></div><div class="ttdeci">static void * pw_array_add(struct pw_array *arr, size_t size)</div><div class="ttdoc">Add ref size bytes to arr.</div><div class="ttdef"><b>Definition:</b> array.h:121</div></div>
<div class="ttc" id="structpw__array_html_ab0929cdf2f7acb291f2f17be299b8ea5"><div class="ttname"><a href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">pw_array::data</a></div><div class="ttdeci">void * data</div><div class="ttdoc">pointer to array data</div><div class="ttdef"><b>Definition:</b> array.h:44</div></div>
<div class="ttc" id="structpw__array_html_a41905dd179bcee03cceef47579e0a22e"><div class="ttname"><a href="structpw__array.html#a41905dd179bcee03cceef47579e0a22e">pw_array::pw_array_init</a></div><div class="ttdeci">static void pw_array_init(struct pw_array *arr, size_t extend)</div><div class="ttdoc">Initialize the array with given extend.</div><div class="ttdef"><b>Definition:</b> array.h:79</div></div>
<div class="ttc" id="structpw__array_html"><div class="ttname"><a href="structpw__array.html">pw_array</a></div><div class="ttdoc">An array object.</div><div class="ttdef"><b>Definition:</b> array.h:43</div></div>
<div class="ttc" id="structpw__array_html_a429b934f5c1580d91af238ac04e44842"><div class="ttname"><a href="structpw__array.html#a429b934f5c1580d91af238ac04e44842">pw_array::alloc</a></div><div class="ttdeci">size_t alloc</div><div class="ttdoc">number of allocated memory in data</div><div class="ttdef"><b>Definition:</b> array.h:46</div></div>
<div class="ttc" id="structpw__array_html_a92ae2df32c3d6935897f41b6e7f5ad3c"><div class="ttname"><a href="structpw__array.html#a92ae2df32c3d6935897f41b6e7f5ad3c">pw_array::extend</a></div><div class="ttdeci">size_t extend</div><div class="ttdoc">number of bytes to extend with</div><div class="ttdef"><b>Definition:</b> array.h:47</div></div>
<div class="ttc" id="structpw__array_html_a3d468425a1a0084f98301e2fd9becc6b"><div class="ttname"><a href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">pw_array::size</a></div><div class="ttdeci">size_t size</div><div class="ttdoc">length of array in bytes</div><div class="ttdef"><b>Definition:</b> array.h:45</div></div>
<div class="ttc" id="structpw__array_html_ae8d9a82b23a44ceb033f7f6ce3b0621d"><div class="ttname"><a href="structpw__array.html#ae8d9a82b23a44ceb033f7f6ce3b0621d">pw_array::pw_array_add_fixed</a></div><div class="ttdeci">static void * pw_array_add_fixed(struct pw_array *arr, size_t size)</div><div class="ttdoc">Add ref size bytes to arr.</div><div class="ttdef"><b>Definition:</b> array.h:136</div></div>
<div class="ttc" id="structdata_html"><div class="ttname"><a href="structdata.html">data</a></div><div class="ttdef"><b>Definition:</b> stream.c:69</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_7129a66c92fe7beef816c2ac906ef0b3.html">pipewire</a></li><li class="navelem"><a class="el" href="array_8h.html">array.h</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
</ul>
</div>
</body>
</html>
|