255 * Passes the pointer in this string to \c free(). |
255 * Passes the pointer in this string to \c free(). |
256 * |
256 * |
257 * The pointer in the struct is set to \c NULL and the length is set to zero. |
257 * The pointer in the struct is set to \c NULL and the length is set to zero. |
258 * |
258 * |
259 * \note There is no implementation for cxstring, because it is unlikely that |
259 * \note There is no implementation for cxstring, because it is unlikely that |
260 * you ever have a \c char \c const* you are really supposed to free. If you |
260 * you ever have a <code>const char*</code> you are really supposed to free. |
261 * encounter such situation, you should double-check your code. |
261 * If you encounter such situation, you should double-check your code. |
262 * |
262 * |
263 * @param str the string to free |
263 * @param str the string to free |
264 */ |
264 */ |
265 __attribute__((__nonnull__)) |
265 __attribute__((__nonnull__)) |
266 void cx_strfree(cxmutstr *str); |
266 void cx_strfree(cxmutstr *str); |
269 * Passes the pointer in this string to the allocators free function. |
269 * Passes the pointer in this string to the allocators free function. |
270 * |
270 * |
271 * The pointer in the struct is set to \c NULL and the length is set to zero. |
271 * The pointer in the struct is set to \c NULL and the length is set to zero. |
272 * |
272 * |
273 * \note There is no implementation for cxstring, because it is unlikely that |
273 * \note There is no implementation for cxstring, because it is unlikely that |
274 * you ever have a \c char \c const* you are really supposed to free. If you |
274 * you ever have a <code>const char*</code> you are really supposed to free. |
275 * encounter such situation, you should double-check your code. |
275 * If you encounter such situation, you should double-check your code. |
276 * |
276 * |
277 * @param alloc the allocator |
277 * @param alloc the allocator |
278 * @param str the string to free |
278 * @param str the string to free |
279 */ |
279 */ |
280 __attribute__((__nonnull__)) |
280 __attribute__((__nonnull__)) |
281 void cx_strfree_a( |
281 void cx_strfree_a( |
282 CxAllocator const *alloc, |
282 const CxAllocator *alloc, |
283 cxmutstr *str |
283 cxmutstr *str |
284 ); |
284 ); |
285 |
285 |
286 /** |
286 /** |
287 * Returns the accumulated length of all specified strings. |
287 * Returns the accumulated length of all specified strings. |
317 * @param ... all other strings |
317 * @param ... all other strings |
318 * @return the concatenated string |
318 * @return the concatenated string |
319 */ |
319 */ |
320 __attribute__((__warn_unused_result__, __nonnull__)) |
320 __attribute__((__warn_unused_result__, __nonnull__)) |
321 cxmutstr cx_strcat_ma( |
321 cxmutstr cx_strcat_ma( |
322 CxAllocator const *alloc, |
322 const CxAllocator *alloc, |
323 cxmutstr str, |
323 cxmutstr str, |
324 size_t count, |
324 size_t count, |
325 ... |
325 ... |
326 ); |
326 ); |
327 |
327 |
627 * written to |
627 * written to |
628 * @return the actual number of split items |
628 * @return the actual number of split items |
629 */ |
629 */ |
630 __attribute__((__warn_unused_result__, __nonnull__)) |
630 __attribute__((__warn_unused_result__, __nonnull__)) |
631 size_t cx_strsplit_a( |
631 size_t cx_strsplit_a( |
632 CxAllocator const *allocator, |
632 const CxAllocator *allocator, |
633 cxstring string, |
633 cxstring string, |
634 cxstring delim, |
634 cxstring delim, |
635 size_t limit, |
635 size_t limit, |
636 cxstring **output |
636 cxstring **output |
637 ); |
637 ); |
676 * written to |
676 * written to |
677 * @return the actual number of split items |
677 * @return the actual number of split items |
678 */ |
678 */ |
679 __attribute__((__warn_unused_result__, __nonnull__)) |
679 __attribute__((__warn_unused_result__, __nonnull__)) |
680 size_t cx_strsplit_ma( |
680 size_t cx_strsplit_ma( |
681 CxAllocator const *allocator, |
681 const CxAllocator *allocator, |
682 cxmutstr string, |
682 cxmutstr string, |
683 cxstring delim, |
683 cxstring delim, |
684 size_t limit, |
684 size_t limit, |
685 cxmutstr **output |
685 cxmutstr **output |
686 ); |
686 ); |
723 * @return negative if \p s1 is smaller than \p s2, positive if \p s1 is larger |
723 * @return negative if \p s1 is smaller than \p s2, positive if \p s1 is larger |
724 * than \p s2, zero if both strings equal |
724 * than \p s2, zero if both strings equal |
725 */ |
725 */ |
726 __attribute__((__warn_unused_result__, __nonnull__)) |
726 __attribute__((__warn_unused_result__, __nonnull__)) |
727 int cx_strcmp_p( |
727 int cx_strcmp_p( |
728 void const *s1, |
728 const void *s1, |
729 void const *s2 |
729 const void *s2 |
730 ); |
730 ); |
731 |
731 |
732 /** |
732 /** |
733 * Compares two strings ignoring case. |
733 * Compares two strings ignoring case. |
734 * |
734 * |
739 * @return negative if \p s1 is smaller than \p s2, positive if \p s1 is larger |
739 * @return negative if \p s1 is smaller than \p s2, positive if \p s1 is larger |
740 * than \p s2, zero if both strings equal ignoring case |
740 * than \p s2, zero if both strings equal ignoring case |
741 */ |
741 */ |
742 __attribute__((__warn_unused_result__, __nonnull__)) |
742 __attribute__((__warn_unused_result__, __nonnull__)) |
743 int cx_strcasecmp_p( |
743 int cx_strcasecmp_p( |
744 void const *s1, |
744 const void *s1, |
745 void const *s2 |
745 const void *s2 |
746 ); |
746 ); |
747 |
747 |
748 |
748 |
749 /** |
749 /** |
750 * Creates a duplicate of the specified string. |
750 * Creates a duplicate of the specified string. |
758 * @return a duplicate of the string |
758 * @return a duplicate of the string |
759 * @see cx_strdup() |
759 * @see cx_strdup() |
760 */ |
760 */ |
761 __attribute__((__warn_unused_result__, __nonnull__)) |
761 __attribute__((__warn_unused_result__, __nonnull__)) |
762 cxmutstr cx_strdup_a( |
762 cxmutstr cx_strdup_a( |
763 CxAllocator const *allocator, |
763 const CxAllocator *allocator, |
764 cxstring string |
764 cxstring string |
765 ); |
765 ); |
766 |
766 |
767 /** |
767 /** |
768 * Creates a duplicate of the specified string. |
768 * Creates a duplicate of the specified string. |
926 * @param replmax maximum number of replacements |
926 * @param replmax maximum number of replacements |
927 * @return the resulting string after applying the replacements |
927 * @return the resulting string after applying the replacements |
928 */ |
928 */ |
929 __attribute__((__warn_unused_result__, __nonnull__)) |
929 __attribute__((__warn_unused_result__, __nonnull__)) |
930 cxmutstr cx_strreplacen_a( |
930 cxmutstr cx_strreplacen_a( |
931 CxAllocator const *allocator, |
931 const CxAllocator *allocator, |
932 cxstring str, |
932 cxstring str, |
933 cxstring pattern, |
933 cxstring pattern, |
934 cxstring replacement, |
934 cxstring replacement, |
935 size_t replmax |
935 size_t replmax |
936 ); |
936 ); |