[PATCH v1] Port ndbm

Vaibhav Gupta vaibhavgupta40@gmail.com
Wed Jul 10 18:19:00 GMT 2019


On Wed, Jul 10, 2019 at 10:14 PM Craig Howland via newlib <
newlib@sourceware.org> wrote:

> On 7/10/19 4:55 AM, Vaibhav Gupta wrote:
> > ---
> >   newlib/libc/include/ndbm.h     |  93 ++++++++++++++
> >   newlib/libc/search/Makefile.am |   1 +
> >   newlib/libc/search/ndbm.c      | 217 +++++++++++++++++++++++++++++++++
> >   3 files changed, 311 insertions(+)
> >   create mode 100644 newlib/libc/include/ndbm.h
> >   create mode 100644 newlib/libc/search/ndbm.c
> >
> > diff --git a/newlib/libc/include/ndbm.h b/newlib/libc/include/ndbm.h
> > ...
> > +typedef struct {
> > +     void *dptr;
> > +     int dsize;      /* XXX Should be size_t according to 1003.1-2008.
> */
> If it is supposed to be size_t, then why isn't it?  I did verify that
> POSIX does
> specify size_t.  (Newlib is starting new here, so it would seem to make
> sense to
> make it right.  Does BSD have int just for legacy compatibility reasons?)
> > +} datum;
> > +
>
Hello,
As Joel mentioned, I ported this code from FreeBSD and haven't changed it.
I did some changes with `<db.h>` header and have mentioned about it, but
have
no idea why BSD have not used `size_t`. We can surely report to them about
it
if needed.

> >
> What about documentation (i.e. man page information)?
> This is POSIX XSI.  Shouldn't there be some kind of gate?  (Or since the
> entire
> header is under XSI, no gate is needed since the user controls it on a
> file
> level?  I prefer this, but I don't know what general Newlib policy is, as
> most
> are mixed in and need individual gates.)
> (These comments are purely focused on the internal contents of the
> proposal, and
> ignore the higher-level questions which have been under discussion about
> the
> __hash_open() prototype, etc.)
>
Sure, but I would like to mention that __hash_open() prototype present in
hash.h in newlib
is old and doesn't even match with open group standards. I mailed a
proposal to update
search directory, on newlib mailing list.

> Craig
>



More information about the Newlib mailing list