[redland-dev] raptor_new_term_from_blank() and NULL

Victor Porton porton at narod.ru
Fri Aug 8 15:10:27 EDT 2014


I am writing thick Ada bindings for Raptor.

Now I work on binding this function:

raptor_term *       raptor_new_term_from_blank          (raptor_world *world,
                                                         const unsigned char *blank);

The documentation says that its behavior changes when `blank == NULL`.

But there is no concept of NULL string in Ada (unless using specific Ada features to interoperate with C, which should not be used in a pure Ada program).

There is certainly empty strings in Ada, but these are not the same as NULL C strings.

As such I propose to make two Ada functions which call raptor_new_term_from_blank (or raptor_new_term_from_counted_blank for better performance):

One Ada function would accept a string which (after conversion to C string) would be passed to raptor_new_term_from_blank.

The other Ada function would not accept a string but call raptor_new_term_from_blank with `blank` set to NULL.

I think it (to make two Ada functions, which by the way can have the same name and differ only in arguments) is a good approach for this problem.

However, I doubt because the C library writers decided to make one raptor_new_term_from_blank function, not two functions for `blank != NULL` and `blank == NULL`. I suspect that this design decision was taken not without reason. So I doubt whether I should deviate from this design in Ada bindings.

So: Should I make one or two functions for this?

--
Victor Porton - http://portonvictor.org


More information about the redland-dev mailing list