/** * librdf_uri_to_counted_string: * @uri: #librdf_uri object * @len_p: pointer to location to store length * * Format the URI as a counted string. * * Note: this method allocates a new string since this is a _to_ method * and the caller must free the resulting memory. * * Return value: string representation of the URI or NULL on failure **/ unsigned char* librdf_uri_to_counted_string (librdf_uri* uri, size_t* len_p) { #ifdef LIBRDF_USE_RAPTOR_URI return raptor_uri_to_counted_string(uri, len_p); #else unsigned char *s; LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(uri, librdf_uri, NULL); if(!uri) return NULL; if(len_p) *len_p=uri->string_length; s=(unsigned char*)LIBRDF_MALLOC(cstring, uri->string_length+1); if(!s) return NULL; strcpy((char*)s, (const char*)uri->string); return s; #endif }
/** * librdf_uri_to_counted_string: * @uri: #librdf_uri object * @len_p: pointer to location to store length * * Format the URI as a counted string. * * Note: this method allocates a new string since this is a _to_ method * and the caller must free the resulting memory. * * Return value: string representation of the URI or NULL on failure **/ unsigned char* librdf_uri_to_counted_string (librdf_uri* uri, size_t* len_p) { return raptor_uri_to_counted_string(uri, len_p); }
/** * raptor_uri_to_string: * @uri: #raptor_uri object * * Get a new string for a URI. * * The memory allocated must be freed by the caller and * raptor_free_memory() should be used for best portability. * * Return value: new string or NULL on failure **/ unsigned char* raptor_uri_to_string(raptor_uri *uri) { return raptor_uri_to_counted_string(uri, NULL); }