Port ndbm.h

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Mon Jun 10 16:09:00 GMT 2019

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:

* 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:

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 *);

 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);

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.

More information about the Newlib mailing list