summaryrefslogtreecommitdiff
path: root/src/raptor_uri.c
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2010-01-23 16:22:08 -0800
committerDave Beckett <dave@dajobe.org>2010-01-23 16:22:08 -0800
commit284095ab8ac2ea6a438e98714317d4cd99de9e23 (patch)
treef35ed9502409f2a7c9e8cd7ebd0db7902de94cce /src/raptor_uri.c
parent38f1547060bb3e25ea3e79cdd33b1ffb2d8a336b (diff)
downloadraptor-284095ab8ac2ea6a438e98714317d4cd99de9e23.tar.gz
Added new uri constructor raptor_new_uri_from_counted_string
(raptor_new_uri_from_counted_string): Added (raptor_new_uri): Now a wrapper around raptor_new_uri_from_counted_string.
Diffstat (limited to 'src/raptor_uri.c')
-rw-r--r--src/raptor_uri.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/raptor_uri.c b/src/raptor_uri.c
index ed4c41f2..bb68171e 100644
--- a/src/raptor_uri.c
+++ b/src/raptor_uri.c
@@ -78,26 +78,26 @@ struct raptor_uri_s {
/**
- * raptor_new_uri:
+ * raptor_new_uri_from_counted_string:
* @world: raptor_world object
* @uri_string: URI string.
+ * @length: lenght of URI string
*
* Constructor - create a raptor URI from a UTF-8 encoded Unicode string.
*
* Return value: a new #raptor_uri object or NULL on failure.
**/
raptor_uri*
-raptor_new_uri(raptor_world* world, const unsigned char *uri_string)
+raptor_new_uri_from_counted_string(raptor_world* world,
+ const unsigned char *uri_string,
+ size_t length)
{
raptor_uri* new_uri;
unsigned char *new_string;
- int length;
if(!uri_string || !*uri_string)
return NULL;
- length = strlen((const char*)uri_string);
-
if(world->uris_tree) {
raptor_uri key; /* on stack - not allocated */
@@ -163,6 +163,26 @@ raptor_new_uri(raptor_world* world, const unsigned char *uri_string)
/**
+ * raptor_new_uri:
+ * @world: raptor_world object
+ * @uri_string: URI string.
+ *
+ * Constructor - create a raptor URI from a UTF-8 encoded Unicode string.
+ *
+ * Return value: a new #raptor_uri object or NULL on failure.
+ **/
+raptor_uri*
+raptor_new_uri(raptor_world* world, const unsigned char *uri_string)
+{
+ if(!world || !uri_string)
+ return NULL;
+
+ return raptor_new_uri_from_counted_string(world, uri_string,
+ strlen((const char*)uri_string));
+}
+
+
+/**
* raptor_new_uri_from_uri_local_name:
* @world: raptor_world object
* @uri: existing #raptor_uri