Skip to content

Instantly share code, notes, and snippets.

@njh
Created September 27, 2010 21:59
Show Gist options
  • Save njh/599957 to your computer and use it in GitHub Desktop.
Save njh/599957 to your computer and use it in GitHub Desktop.
diff --git a/src/raptor_uri.c b/src/raptor_uri.c
index f147bb9..cda374d 100644
--- a/src/raptor_uri.c
+++ b/src/raptor_uri.c
@@ -466,8 +466,11 @@ raptor_uri_compare(raptor_uri* uri1, raptor_uri* uri2)
if(uri1 == uri2)
return 0;
- if(uri1 && uri2)
- return strcmp((const char*)uri1->string, (const char*)uri2->string);
+ if(uri1 && uri2) {
+ unsigned int len = (uri1->length > uri2->length) ?
+ uri1->length : uri2->length;
+ return strncmp((const char*)uri1->string, (const char*)uri2->string, len);
+ }
/* One arg is NULL - sort that first */
return (!uri1) ? -1 : 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment