[redland-dev] Re: [patch] librdf_stream_get_context

Michael Stahl Michael.Stahl at Sun.com
Mon May 5 10:26:35 BST 2008


Lauri Aalto wrote:
> Thank you for the question and patch.
> =

> On Fri, May 2, 2008 at 1:58 PM, Michael Stahl <Michael.Stahl at sun.com> wro=
te:
>>  so, i noticed that librdf_stream_get_context returns a void*... why?
> =

> I don't really know.
> =

> I'd guess it comes from the fact that the underlying stream callback
> get_method returns a void* as it will return librdf_statement* or
> librdf_node*, depending on the flags passed in. That makes it easy to
> use void*s internally and transfer the burden of type casting to
> caller.
> =

> librdf_stream inherits its core design from librdf_iterator. According
> to svn logs, latest significant changes to that design are from 2002.
> =

>>  imho it should return librdf_node* instead.
>>  patch is attached.
> =

> Agree, returing librdf_node* makes sense. However, it would introduce
> a slight API break and would not bring much benefit as such. I'd like
> to hear dajobe's take on this issue.
> =

> The patch itself is not sufficient:
> =

> - prototypes in rdf_stream.h are not changed
> =

> - should keep rdf_stream consistent with rdf_iterator -> patch
> rdf_iterator.[ch] as well
> =

> Lauri

oops, sorry, i was in a hurry when i wrote that, so i forgot about trivial =

things, like checking whether the patch even builds :)
so i've made a new patch, and it actually compiles...

i would assume that this change would only break programs that cast the =

returned pointer to something other than either void* or librdf_node*, =

which would be incorrect anyway...

-- =

"Most programming environments are meta-engineered to make typical
  software easier to write. They should instead be meta-engineered to
  make incorrect software harder to write." -- Daniel J. Bernstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: redland-1.0.7-get_context.patch
Type: text/x-patch
Size: 2339 bytes
Desc: not available
Url : http://lists.usefulinc.com/pipermail/redland-dev/attachments/20080505=
/efe4db43/redland-1.0.7-get_context.bin


More information about the redland-dev mailing list