/** *Instanciate a string and initialise it to *a_string. *@param a_string the initial string *@return the newly instanciated string. */ CRString * cr_string_new_from_string (const gchar * a_string) { CRString *result = cr_string_new () ; if (!result) { cr_utils_trace_info ("Out of memory") ; return NULL ; } if (a_string) g_string_append (result->stryng, a_string) ; return result ; }
/** *Instanciates a #CRString from an instance of GString. *@param a_string the input string that will be copied into *the newly instanciated #CRString *@return the newly instanciated #CRString. */ CRString * cr_string_new_from_gstring (GString *a_string) { CRString *result = cr_string_new () ; if (!result) { cr_utils_trace_info ("Out of memory") ; return NULL ; } if (a_string) { result->stryng = g_string_new_len (a_string->str, a_string->len) ; } else { result->stryng = g_string_new (NULL) ; } return result ; }
/** *Instanciates a #CRString from an instance of GString. *@param a_string the input string that will be copied into *the newly instanciated #CRString *@return the newly instanciated #CRString. */ CRString * cr_string_new_from_gstring (GString const *a_string) { CRString *result = NULL ; result = cr_string_new () ; if (!result) { cr_utils_trace_info ("Out of memory") ; return NULL ; } if (a_string) { g_string_append_len (result->stryng, a_string->str, a_string->len); } return result ; }