Port ndbm.h

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Port ndbm.h

Vaibhav Gupta
Hello everyone,
I have ported    ndbm.h    to newlib from FreeBSD.
I have placed     ndbm.h     to     newlib/libc/include     directory
and
ndbm.c     to    newlib/libc/posix     directory .

But I realized, the function declaration of __hash_open in newlib is:
DB      *__hash_open(const char *, int, int, int, const HASHINFO *);

and in FreeBSD it is:
DB      *__hash_open(const char *, int, int, const HASHINFO *, int);
.
.
.
.
Although I made required changes in    ndbm.c      but I guess maybe the
entire search.h should be updated to newer FreeBSD resource?
Should we do that?
Reply | Threaded
Open this post in threaded view
|

Re: Port ndbm.h

Brian Inglis

On 2019-06-09 21:55, Vaibhav Gupta wrote:

> I have ported ndbm.h to newlib from FreeBSD.
> I have placed ndbm.h to newlib/libc/include directory and ndbm.c to
> newlib/libc/posix directory.
> But I realized, the function declaration of __hash_open in newlib is:
> DB *__hash_open(const char *, int, int, int, const HASHINFO *);
> and in FreeBSD it is:
> DB *__hash_open(const char *, int, int, const HASHINFO *, int);
> Although I made required changes in ndbm.c but I guess maybe the entire
> search.h should be updated to newer FreeBSD resource?
> Should we do that?

I think this needs to be discussed more widely with previous maintainers.

Args were switched in 2010 commit:
https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=b73e65bb44e2bac2b3e0a7a2a9f596ccb47e05a5

* libm/math/ef_sqrt.c: Delete unused variable sign.
* libc/stdlib/getenv.c: Delete "char *_findenv_r ();", as is not a
proper prototype, and is properly prototyped in stdlib.h, anyway.
* libc/stdlib/getenv_r.c: Ditto.
* libc/search/hash.c: Add _DEFUN to __hash_open() declaration; add
#define __DBINTERFACE_PRIVATE to activate prototypes from db_local.h.
* libc/search/db_local.h: Correct __hash_open() prototype.
* libc/sys/linux/cmath/math_private.h:  Eliminate compiler warnings:
Remove #define INFINITY (redefines from math.h); remove #define __isnanf
and #define __isinff isinff.

newlib/libc/search/db_local.h diff:
https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=blobdiff;f=newlib/libc/search/db_local.h;h=ec621fabf53f060b62fd3922f07d00ba0d8221c8;hp=53f9d17ff5abd8727be1a5b12e512131a6f8a287;hb=b73e65bb44e2bac2b3e0a7a2a9f596ccb47e05a5;hpb=56fbdfab68cf4577781e8623fe4c6d13ca7ec727

diff --git a/newlib/libc/search/db_local.h b/newlib/libc/search/db_local.h
index 53f9d17..ec621fa 100644 (file)
--- a/newlib/libc/search/db_local.h
+++ b/newlib/libc/search/db_local.h
@@ -210,7 +210,7 @@ DB *dbopen(const char *, int, int, DBTYPE, const void *);

 #ifdef __DBINTERFACE_PRIVATE
 DB     *__bt_open(const char *, int, int, const BTREEINFO *, int);
-DB     *__hash_open(const char *, int, int, const HASHINFO *, int);
+DB     *__hash_open(const char *, int, int, int, const HASHINFO *);
 DB     *__rec_open(const char *, int, int, const RECNOINFO *, int);
 void    __dbpanic(DB *dbp);
 #endif

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
Reply | Threaded
Open this post in threaded view
|

Re: Port ndbm.h

Vaibhav Gupta
On Mon, Jun 10, 2019 at 9:39 PM Brian Inglis <
[hidden email]> wrote:

>
> On 2019-06-09 21:55, Vaibhav Gupta wrote:
> > I have ported ndbm.h to newlib from FreeBSD.
> > I have placed ndbm.h to newlib/libc/include directory and ndbm.c to
> > newlib/libc/posix directory.
> > But I realized, the function declaration of __hash_open in newlib is:
> > DB *__hash_open(const char *, int, int, int, const HASHINFO *);
> > and in FreeBSD it is:
> > DB *__hash_open(const char *, int, int, const HASHINFO *, int);
> > Although I made required changes in ndbm.c but I guess maybe the entire
> > search.h should be updated to newer FreeBSD resource?
> > Should we do that?
>
> I think this needs to be discussed more widely with previous maintainers.
>
I am totally interested, once it all gets clear, I can successfully port
ndbm.

>
> Args were switched in 2010 commit:
>
> https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=b73e65bb44e2bac2b3e0a7a2a9f596ccb47e05a5
>
> * libm/math/ef_sqrt.c: Delete unused variable sign.
> * libc/stdlib/getenv.c: Delete "char *_findenv_r ();", as is not a
> proper prototype, and is properly prototyped in stdlib.h, anyway.
> * libc/stdlib/getenv_r.c: Ditto.
> * libc/search/hash.c: Add _DEFUN to __hash_open() declaration; add
> #define __DBINTERFACE_PRIVATE to activate prototypes from db_local.h.
>
yeah, I had to add this line in ndbm.h while porting to use
__hash_open()

> * libc/search/db_local.h: Correct __hash_open() prototype.
> * libc/sys/linux/cmath/math_private.h:  Eliminate compiler warnings:
> Remove #define INFINITY (redefines from math.h); remove #define __isnanf
> and #define __isinff isinff.
>
> newlib/libc/search/db_local.h diff:
>
> https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=blobdiff;f=newlib/libc/search/db_local.h;h=ec621fabf53f060b62fd3922f07d00ba0d8221c8;hp=53f9d17ff5abd8727be1a5b12e512131a6f8a287;hb=b73e65bb44e2bac2b3e0a7a2a9f596ccb47e05a5;hpb=56fbdfab68cf4577781e8623fe4c6d13ca7ec727
>
> diff --git a/newlib/libc/search/db_local.h b/newlib/libc/search/db_local.h
> index 53f9d17..ec621fa 100644 (file)
> --- a/newlib/libc/search/db_local.h
> +++ b/newlib/libc/search/db_local.h
> @@ -210,7 +210,7 @@ DB *dbopen(const char *, int, int, DBTYPE, const void
> *);
>
>  #ifdef __DBINTERFACE_PRIVATE
>  DB     *__bt_open(const char *, int, int, const BTREEINFO *, int);
> -DB     *__hash_open(const char *, int, int, const HASHINFO *, int);
> +DB     *__hash_open(const char *, int, int, int, const HASHINFO *);
>  DB     *__rec_open(const char *, int, int, const RECNOINFO *, int);
>  void    __dbpanic(DB *dbp);
>  #endif
>
> --
> Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
>
> This email may be disturbing to some readers as it contains
> too much technical detail. Reader discretion is advised.
>