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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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"/>
<title>rpm: rpmstring.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">rpm <span id="projectnumber">4.9.1</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">rpmstring.h</div> </div>
</div>
<div class="contents">
<a href="rpmstring_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef _RPMSTRING_H_</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define _RPMSTRING_H_</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00009"></a>00009 <span class="preprocessor">#include <stddef.h></span>
<a name="l00010"></a>00010 <span class="preprocessor">#include <string.h></span>
<a name="l00011"></a>00011
<a name="l00012"></a>00012 <span class="preprocessor">#include <rpm/rpmutil.h></span>
<a name="l00013"></a>00013
<a name="l00014"></a>00014 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00016"></a>00016 <span class="preprocessor">#endif</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00022"></a><a class="code" href="group__rpmstring.html#ga8949596c31b824ed2ed496572ac4dab2">00022</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#ga8949596c31b824ed2ed496572ac4dab2" title="Locale insensitive islower(3)">rislower</a>(<span class="keywordtype">int</span> c) {
<a name="l00023"></a>00023 <span class="keywordflow">return</span> (c >= <span class="charliteral">'a'</span> && c <= <span class="charliteral">'z'</span>);
<a name="l00024"></a>00024 }
<a name="l00025"></a>00025
<a name="l00029"></a>00029 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00030"></a><a class="code" href="group__rpmstring.html#gae41a3473054167af2a5fcb7e94ccb0e6">00030</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#gae41a3473054167af2a5fcb7e94ccb0e6" title="Locale insensitive isupper(3)">risupper</a>(<span class="keywordtype">int</span> c) {
<a name="l00031"></a>00031 <span class="keywordflow">return</span> (c >= <span class="charliteral">'A'</span> && c <= <span class="charliteral">'Z'</span>);
<a name="l00032"></a>00032 }
<a name="l00033"></a>00033
<a name="l00037"></a>00037 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00038"></a><a class="code" href="group__rpmstring.html#ga1059066592fc30325257903e37fa9523">00038</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#ga1059066592fc30325257903e37fa9523" title="Locale insensitive isalpha(3)">risalpha</a>(<span class="keywordtype">int</span> c) {
<a name="l00039"></a>00039 <span class="keywordflow">return</span> (<a class="code" href="group__rpmstring.html#ga8949596c31b824ed2ed496572ac4dab2" title="Locale insensitive islower(3)">rislower</a>(c) || <a class="code" href="group__rpmstring.html#gae41a3473054167af2a5fcb7e94ccb0e6" title="Locale insensitive isupper(3)">risupper</a>(c));
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041
<a name="l00045"></a>00045 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00046"></a><a class="code" href="group__rpmstring.html#ga1ca7980c13315e4d26207b765ac14838">00046</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#ga1ca7980c13315e4d26207b765ac14838" title="Locale insensitive isdigit(3)">risdigit</a>(<span class="keywordtype">int</span> c) {
<a name="l00047"></a>00047 <span class="keywordflow">return</span> (c >= <span class="charliteral">'0'</span> && c <= <span class="charliteral">'9'</span>);
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049
<a name="l00053"></a>00053 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00054"></a><a class="code" href="group__rpmstring.html#gacbd496a4291f832e497c57340bcd555b">00054</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#gacbd496a4291f832e497c57340bcd555b" title="Locale insensitive isalnum(3)">risalnum</a>(<span class="keywordtype">int</span> c) {
<a name="l00055"></a>00055 <span class="keywordflow">return</span> (<a class="code" href="group__rpmstring.html#ga1059066592fc30325257903e37fa9523" title="Locale insensitive isalpha(3)">risalpha</a>(c) || <a class="code" href="group__rpmstring.html#ga1ca7980c13315e4d26207b765ac14838" title="Locale insensitive isdigit(3)">risdigit</a>(c));
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057
<a name="l00061"></a>00061 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00062"></a><a class="code" href="group__rpmstring.html#gae36d2cf663bdc40226c39b1ae69bd941">00062</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#gae36d2cf663bdc40226c39b1ae69bd941" title="Locale insensitive isblank(3)">risblank</a>(<span class="keywordtype">int</span> c) {
<a name="l00063"></a>00063 <span class="keywordflow">return</span> (c == <span class="charliteral">' '</span> || c == <span class="charliteral">'\t'</span>);
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065
<a name="l00069"></a>00069 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00070"></a><a class="code" href="group__rpmstring.html#gaadacea87fc0dae96728220df85c99d52">00070</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#gaadacea87fc0dae96728220df85c99d52" title="Locale insensitive isspace(3)">risspace</a>(<span class="keywordtype">int</span> c) {
<a name="l00071"></a>00071 <span class="keywordflow">return</span> (<a class="code" href="group__rpmstring.html#gae36d2cf663bdc40226c39b1ae69bd941" title="Locale insensitive isblank(3)">risblank</a>(c) || c == <span class="charliteral">'\n'</span> || c == <span class="charliteral">'\r'</span> || c == <span class="charliteral">'\f'</span> || c == <span class="charliteral">'\v'</span>);
<a name="l00072"></a>00072 }
<a name="l00073"></a>00073
<a name="l00077"></a>00077 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00078"></a><a class="code" href="group__rpmstring.html#ga04226ba0cef6fef56ab42d61744ea3fd">00078</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#ga04226ba0cef6fef56ab42d61744ea3fd" title="Locale insensitive tolower(3)">rtolower</a>(<span class="keywordtype">int</span> c) {
<a name="l00079"></a>00079 <span class="keywordflow">return</span> ((<a class="code" href="group__rpmstring.html#gae41a3473054167af2a5fcb7e94ccb0e6" title="Locale insensitive isupper(3)">risupper</a>(c)) ? (c | (<span class="charliteral">'a'</span> - <span class="charliteral">'A'</span>)) : c);
<a name="l00080"></a>00080 }
<a name="l00081"></a>00081
<a name="l00085"></a>00085 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00086"></a><a class="code" href="group__rpmstring.html#ga0e74fcc0dc27410f5b5dd996468e57b2">00086</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#ga0e74fcc0dc27410f5b5dd996468e57b2" title="Locale insensitive toupper(3)">rtoupper</a>(<span class="keywordtype">int</span> c) {
<a name="l00087"></a>00087 <span class="keywordflow">return</span> ((<a class="code" href="group__rpmstring.html#ga8949596c31b824ed2ed496572ac4dab2" title="Locale insensitive islower(3)">rislower</a>(c)) ? (c & ~(<span class="charliteral">'a'</span> - <span class="charliteral">'A'</span>)) : c);
<a name="l00088"></a>00088 }
<a name="l00089"></a>00089
<a name="l00095"></a>00095 <a class="code" href="rpmutil_8h.html#a42bc7874ff5074aa0aa528838e0bfd91">RPM_GNUC_CONST</a>
<a name="l00096"></a><a class="code" href="rpmstring_8h.html#a3b25bcce64eb38e449be58640169c209">00096</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="rpmstring_8h.html#a3b25bcce64eb38e449be58640169c209" title="Convert hex to binary nibble.">rnibble</a>(<span class="keywordtype">char</span> c)
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098 <span class="keywordflow">if</span> (c >= <span class="charliteral">'0'</span> && c <= <span class="charliteral">'9'</span>)
<a name="l00099"></a>00099 <span class="keywordflow">return</span> (c - <span class="charliteral">'0'</span>);
<a name="l00100"></a>00100 <span class="keywordflow">if</span> (c >= <span class="charliteral">'A'</span> && c <= <span class="charliteral">'F'</span>)
<a name="l00101"></a>00101 <span class="keywordflow">return</span> (c - <span class="charliteral">'A'</span>) + 10;
<a name="l00102"></a>00102 <span class="keywordflow">if</span> (c >= <span class="charliteral">'a'</span> && c <= <span class="charliteral">'f'</span>)
<a name="l00103"></a>00103 <span class="keywordflow">return</span> (c - <span class="charliteral">'a'</span>) + 10;
<a name="l00104"></a>00104 <span class="keywordflow">return</span> 0;
<a name="l00105"></a>00105 }
<a name="l00106"></a>00106
<a name="l00113"></a><a class="code" href="rpmstring_8h.html#a1e5f8ebc49cc189053eb455e500d7e00">00113</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="rpmstring_8h.html#a1e5f8ebc49cc189053eb455e500d7e00" title="Test for string equality.">rstreq</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s1, <span class="keyword">const</span> <span class="keywordtype">char</span> *s2)
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115 <span class="keywordflow">return</span> (strcmp(s1, s2) == 0);
<a name="l00116"></a>00116 }
<a name="l00117"></a>00117
<a name="l00125"></a><a class="code" href="rpmstring_8h.html#afdf66df6f44297ae6b342127301c9e36">00125</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="rpmstring_8h.html#afdf66df6f44297ae6b342127301c9e36" title="Test for string equality.">rstreqn</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s1, <span class="keyword">const</span> <span class="keywordtype">char</span> *s2, <span class="keywordtype">size_t</span> n)
<a name="l00126"></a>00126 {
<a name="l00127"></a>00127 <span class="keywordflow">return</span> (strncmp(s1, s2, n) == 0);
<a name="l00128"></a>00128 }
<a name="l00129"></a>00129
<a name="l00133"></a>00133 <a class="code" href="rpmutil_8h.html#aa915ed180c0020d54d080555e1f55d8b">RPM_GNUC_PURE</a>
<a name="l00134"></a>00134 <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#ga6dd6f3c58033734cafc9f54c1ab96b44" title="Locale insensitive strcasecmp(3).">rstrcasecmp</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * s1, <span class="keyword">const</span> <span class="keywordtype">char</span> * s2) ;
<a name="l00135"></a>00135
<a name="l00139"></a>00139 <a class="code" href="rpmutil_8h.html#aa915ed180c0020d54d080555e1f55d8b">RPM_GNUC_PURE</a>
<a name="l00140"></a>00140 <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#gae228682d8efd91160c7c4caaecc29a4e" title="Locale insensitive strncasecmp(3).">rstrncasecmp</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s1, <span class="keyword">const</span> <span class="keywordtype">char</span> * s2, <span class="keywordtype">size_t</span> n) ;
<a name="l00141"></a>00141
<a name="l00145"></a>00145 <span class="keywordtype">int</span> <a class="code" href="group__rpmstring.html#gaef54821b6f5090df66cb7e99e1e8e3c8" title="asprintf() clone">rasprintf</a>(<span class="keywordtype">char</span> **strp, <span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...) <a class="code" href="rpmutil_8h.html#afa56337204e88d492c1d951424b0bea5">RPM_GNUC_PRINTF</a>(2, 3);
<a name="l00146"></a>00146
<a name="l00153"></a>00153 <span class="keywordtype">char</span> *<a class="code" href="group__rpmstring.html#ga4ca948f1b9855baa0b62aa630d532095" title="Concatenate two strings with dynamically (re)allocated memory.">rstrcat</a>(<span class="keywordtype">char</span> **dest, const <span class="keywordtype">char</span> *src);
<a name="l00154"></a>00154
<a name="l00161"></a>00161 <span class="keywordtype">char</span> *<a class="code" href="group__rpmstring.html#gae110db3befa40c8fcd2a15f61786b88b" title="Concatenate multiple strings with dynamically (re)allocated memory.">rstrscat</a>(<span class="keywordtype">char</span> **dest, const <span class="keywordtype">char</span> *arg, ...) <a class="code" href="rpmutil_8h.html#ab20b5f4a77194dc7171b2311853db5cd">RPM_GNUC_NULL_TERMINATED</a>;
<a name="l00162"></a>00162
<a name="l00173"></a>00173 <span class="keywordtype">size_t</span> <a class="code" href="group__rpmstring.html#gab3e83839ca93d0b6d91327881b0658d8" title="strlcpy() clone: Copy src to string dest of size n.">rstrlcpy</a>(<span class="keywordtype">char</span> *dest, const <span class="keywordtype">char</span> *src, <span class="keywordtype">size_t</span> n);
<a name="l00174"></a>00174
<a name="l00175"></a>00175 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00176"></a>00176 <span class="preprocessor"></span>}
<a name="l00177"></a>00177 <span class="preprocessor">#endif</span>
<a name="l00178"></a>00178 <span class="preprocessor"></span>
<a name="l00179"></a>00179 <span class="preprocessor">#endif </span><span class="comment">/* _RPMSTRING_H_ */</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Fri Jul 15 2011 for rpm by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
|