src/cx/string.h

changeset 700
72dccb560084
parent 697
ebdce4bf262b
child 759
475335643af4
equal deleted inserted replaced
699:35b2b99ee523 700:72dccb560084
772 * @return a duplicate of the string 772 * @return a duplicate of the string
773 * @see cx_strdup_a() 773 * @see cx_strdup_a()
774 */ 774 */
775 #define cx_strdup(string) cx_strdup_a(cxDefaultAllocator, string) 775 #define cx_strdup(string) cx_strdup_a(cxDefaultAllocator, string)
776 776
777
778 /**
779 * Creates a duplicate of the specified string.
780 *
781 * The new string will contain a copy allocated by \p allocator.
782 *
783 * \note The returned string is guaranteed to be zero-terminated.
784 *
785 * @param allocator the allocator to use
786 * @param string the string to duplicate
787 * @return a duplicate of the string
788 * @see cx_strdup_m()
789 */
790 #define cx_strdup_ma(allocator, string) cx_strdup_a(allocator, cx_strcast(string))
791
792 /**
793 * Creates a duplicate of the specified string.
794 *
795 * The new string will contain a copy allocated by standard
796 * \c malloc(). So developers \em must pass the return value to cx_strfree().
797 *
798 * \note The returned string is guaranteed to be zero-terminated.
799 *
800 * @param string the string to duplicate
801 * @return a duplicate of the string
802 * @see cx_strdup_ma()
803 */
804 #define cx_strdup_m(string) cx_strdup_a(cxDefaultAllocator, cx_strcast(string))
805
777 /** 806 /**
778 * Omits leading and trailing spaces. 807 * Omits leading and trailing spaces.
779 * 808 *
780 * \note the returned string references the same memory, thus you 809 * \note the returned string references the same memory, thus you
781 * must \em not free the returned memory. 810 * must \em not free the returned memory.

mercurial