ucx/string.h

changeset 225
a1a068c2c4ef
parent 214
2bc19726c340
child 233
bd58fdde142d
equal deleted inserted replaced
224:f9ba63fc6a80 225:a1a068c2c4ef
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2015 Olaf Wintermann. All rights reserved. 4 * Copyright 2016 Olaf Wintermann. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
135 * @return the concatenated string 135 * @return the concatenated string
136 */ 136 */
137 sstr_t sstrcat(size_t count, sstr_t s1, sstr_t s2, ...); 137 sstr_t sstrcat(size_t count, sstr_t s1, sstr_t s2, ...);
138 138
139 /** 139 /**
140 * Concatenates two or more strings using an UcxAllocator. 140 * Concatenates two or more strings using a UcxAllocator.
141 * 141 *
142 * See sstrcat() for details. 142 * See sstrcat() for details.
143 * 143 *
144 * @param a the allocator to use 144 * @param a the allocator to use
145 * @param count the total number of strings to concatenate 145 * @param count the total number of strings to concatenate
275 * @see sstrsplit_a() 275 * @see sstrsplit_a()
276 */ 276 */
277 sstr_t* sstrsplit(sstr_t string, sstr_t delim, ssize_t *count); 277 sstr_t* sstrsplit(sstr_t string, sstr_t delim, ssize_t *count);
278 278
279 /** 279 /**
280 * Performing sstrsplit() using an UcxAllocator. 280 * Performing sstrsplit() using a UcxAllocator.
281 * 281 *
282 * <i>Read the description of sstrsplit() for details.</i> 282 * <i>Read the description of sstrsplit() for details.</i>
283 * 283 *
284 * The memory for the sstr_t.ptr pointers of the array items and the memory for 284 * The memory for the sstr_t.ptr pointers of the array items and the memory for
285 * the sstr_t array itself are allocated by using the UcxAllocator.malloc() 285 * the sstr_t array itself are allocated by using the UcxAllocator.malloc()
346 * @see sstrdup_a() 346 * @see sstrdup_a()
347 */ 347 */
348 sstr_t sstrdup(sstr_t string); 348 sstr_t sstrdup(sstr_t string);
349 349
350 /** 350 /**
351 * Creates a duplicate of the specified string using an UcxAllocator. 351 * Creates a duplicate of the specified string using a UcxAllocator.
352 * 352 *
353 * The new sstr_t will contain a copy allocated by the allocators 353 * The new sstr_t will contain a copy allocated by the allocators
354 * ucx_allocator_malloc function. So it is implementation depended, whether the 354 * ucx_allocator_malloc function. So it is implementation depended, whether the
355 * returned sstr_t.ptr pointer must be passed to the allocators 355 * returned sstr_t.ptr pointer must be passed to the allocators
356 * ucx_allocator_free function manually. 356 * ucx_allocator_free function manually.
357 * 357 *
358 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- 358 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>-
359 * terminated. 359 * terminated.
360 * 360 *
361 * @param allocator a valid instance of an UcxAllocator 361 * @param allocator a valid instance of a UcxAllocator
362 * @param string the string to duplicate 362 * @param string the string to duplicate
363 * @return a duplicate of the string 363 * @return a duplicate of the string
364 * @see sstrdup() 364 * @see sstrdup()
365 */ 365 */
366 sstr_t sstrdup_a(UcxAllocator *allocator, sstr_t string); 366 sstr_t sstrdup_a(UcxAllocator *allocator, sstr_t string);

mercurial