Mercurial > audlegacy-plugins
comparison src/sid/xs_support.c @ 1576:716bbba83929
Constify arguments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 03 Sep 2007 08:43:47 +0300 |
parents | 71a2e6b5b713 |
children | 59e8f118ad34 |
comparison
equal
deleted
inserted
replaced
1575:71a2e6b5b713 | 1576:716bbba83929 |
---|---|
142 | 142 |
143 | 143 |
144 | 144 |
145 /* Copy a string | 145 /* Copy a string |
146 */ | 146 */ |
147 gchar *xs_strncpy(gchar *pDest, gchar *pSource, size_t n) | 147 gchar *xs_strncpy(gchar *pDest, const gchar *pSource, size_t n) |
148 { | 148 { |
149 gchar *s, *d; | 149 const gchar *s; |
150 gchar *d; | |
150 size_t i; | 151 size_t i; |
151 | 152 |
152 /* Check the string pointers */ | 153 /* Check the string pointers */ |
153 if (!pSource || !pDest) | 154 if (!pSource || !pDest) |
154 return pDest; | 155 return pDest; |
222 | 223 |
223 | 224 |
224 /* Concatenate a given string up to given dest size or \n. | 225 /* Concatenate a given string up to given dest size or \n. |
225 * If size max is reached, change the end to "..." | 226 * If size max is reached, change the end to "..." |
226 */ | 227 */ |
227 void xs_pnstrcat(gchar *pDest, size_t iSize, gchar *pStr) | 228 void xs_pnstrcat(gchar *pDest, size_t iSize, const gchar *pStr) |
228 { | 229 { |
229 size_t i, n; | 230 size_t i, n; |
230 gchar *s, *d; | 231 const gchar *s; |
232 gchar *d; | |
231 | 233 |
232 d = pDest; | 234 d = pDest; |
233 i = 0; | 235 i = 0; |
234 while (*d && (i < iSize)) { | 236 while (*d && (i < iSize)) { |
235 i++; | 237 i++; |
260 } | 262 } |
261 | 263 |
262 | 264 |
263 /* Locate character in string | 265 /* Locate character in string |
264 */ | 266 */ |
265 gchar *xs_strrchr(gchar *pcStr, gchar ch) | 267 gchar *xs_strrchr(gchar *pcStr, const gchar ch) |
266 { | 268 { |
267 gchar *lastPos = NULL; | 269 gchar *lastPos = NULL; |
268 | 270 |
269 while (*pcStr) { | 271 while (*pcStr) { |
270 if (*pcStr == ch) | 272 if (*pcStr == ch) |
274 | 276 |
275 return lastPos; | 277 return lastPos; |
276 } | 278 } |
277 | 279 |
278 | 280 |
279 void xs_findnext(gchar *pcStr, size_t *piPos) | 281 void xs_findnext(const gchar *pcStr, size_t *piPos) |
280 { | 282 { |
281 while (pcStr[*piPos] && isspace(pcStr[*piPos])) | 283 while (pcStr[*piPos] && isspace(pcStr[*piPos])) |
282 (*piPos)++; | 284 (*piPos)++; |
283 } | 285 } |
284 | 286 |
285 | 287 |
286 void xs_findeol(gchar *pcStr, size_t *piPos) | 288 void xs_findeol(const gchar *pcStr, size_t *piPos) |
287 { | 289 { |
288 while (pcStr[*piPos] && (pcStr[*piPos] != '\n') && (pcStr[*piPos] != '\r')) | 290 while (pcStr[*piPos] && (pcStr[*piPos] != '\n') && (pcStr[*piPos] != '\r')) |
289 (*piPos)++; | 291 (*piPos)++; |
290 } | 292 } |
291 | 293 |
292 | 294 |
293 void xs_findnum(gchar *pcStr, size_t *piPos) | 295 void xs_findnum(const gchar *pcStr, size_t *piPos) |
294 { | 296 { |
295 while (pcStr[*piPos] && isdigit(pcStr[*piPos])) | 297 while (pcStr[*piPos] && isdigit(pcStr[*piPos])) |
296 (*piPos)++; | 298 (*piPos)++; |
297 } | 299 } |
298 | 300 |