[redland-dev] Patch: librdf_storage_context_add_statement{,s}
René Puls
rpuls+lists at kcore.de
Sun Sep 19 12:10:05 BST 2004
Hi,
this patch fixes a small bug which caused an assertion failure when
passing a NULL context parameter to the
librdf_storage_context_add_statement and
librdf_storage_context_add_statements functions. The documentation says
this should be equivalent to calling the non-context functions, but it
wasn't.
librdf_storage_context_add_statements now also requires that the stream
parameter is non-NULL, since this is also true for the
librdf_storage_add_statements function.
Kind regards,
René Puls
-------------- next part --------------
--- redland-0.9.19.old/librdf/rdf_storage.c Fri Aug 13 12:55:54 2004
+++ redland-0.9.19/librdf/rdf_storage.c Sun Sep 19 12:42:54 2004
@@ -1095,15 +1095,18 @@
**/
int
librdf_storage_context_add_statement(librdf_storage* storage,
librdf_node* context,
librdf_statement* statement)
{
LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(storage, librdf_storage, 1);
- LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(context, librdf_statement, 1);
+ LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(statement, librdf_statement, 1);
+
+ if (!context)
+ return librdf_storage_add_statement(storage, statement);
if(storage->factory->context_add_statement)
return storage->factory->context_add_statement(storage, context, statement);
return 1;
}
@@ -1121,15 +1124,18 @@
librdf_storage_context_add_statements(librdf_storage* storage,
librdf_node* context,
librdf_stream* stream)
{
int status=0;
LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(storage, librdf_storage, 1);
- LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(context, librdf_statement, 1);
+ LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(stream, librdf_stream, 1);
+
+ if (!context)
+ return librdf_storage_add_statements(storage, stream);
if(storage->factory->context_add_statements)
return storage->factory->context_add_statements(storage, context, stream);
if(!storage->factory->context_add_statement)
return 1;
More information about the redland-dev
mailing list