Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1513913 - Rename symbols with __ names in dbm, r=jcj
These have been shown to collice.  This also renames two types: `struct __db`
and `__default_hash`.  A global, `__sigtemp` is also renamed (though removed
might be better, I don't want to do too much here).

I considered also renaming __DBINTERFACE_PRIVATE, but that is part of the
external interface.

--HG--
extra : source : dafd3408e5aa8fe1c9d127982a6d5e88bca7e00d
extra : amend_source : f282f42591ef9cf01aae8399b60534620b2f463d
  • Loading branch information
martinthomson committed Dec 24, 2018
1 parent 69203ee commit b9dad25
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 193 deletions.
48 changes: 24 additions & 24 deletions lib/dbm/include/extern.h
Expand Up @@ -31,32 +31,32 @@
* @(#)extern.h 8.4 (Berkeley) 6/16/94
*/

BUFHEAD *__add_ovflpage(HTAB *, BUFHEAD *);
int __addel(HTAB *, BUFHEAD *, const DBT *, const DBT *);
int __big_delete(HTAB *, BUFHEAD *);
int __big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *);
int __big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int);
int __big_return(HTAB *, BUFHEAD *, int, DBT *, int);
int __big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
uint32, uint32, SPLIT_RETURN *);
int __buf_free(HTAB *, int, int);
void __buf_init(HTAB *, int);
uint32 __call_hash(HTAB *, char *, size_t);
int __delpair(HTAB *, BUFHEAD *, int);
int __expand_table(HTAB *);
int __find_bigpair(HTAB *, BUFHEAD *, int, char *, int);
uint16 __find_last_page(HTAB *, BUFHEAD **);
void __free_ovflpage(HTAB *, BUFHEAD *);
BUFHEAD *__get_buf(HTAB *, uint32, BUFHEAD *, int);
int __get_page(HTAB *, char *, uint32, int, int, int);
int __ibitmap(HTAB *, int, int, int);
uint32 __log2(uint32);
int __put_page(HTAB *, char *, uint32, int, int);
void __reclaim_buf(HTAB *, BUFHEAD *);
int __split_page(HTAB *, uint32, uint32);
BUFHEAD *dbm_add_ovflpage(HTAB *, BUFHEAD *);
int dbm_addel(HTAB *, BUFHEAD *, const DBT *, const DBT *);
int dbm_big_delete(HTAB *, BUFHEAD *);
int dbm_big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *);
int dbm_big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int);
int dbm_big_return(HTAB *, BUFHEAD *, int, DBT *, int);
int dbm_big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
uint32, uint32, SPLIT_RETURN *);
int dbm_buf_free(HTAB *, int, int);
void dbm_buf_init(HTAB *, int);
uint32 dbm_call_hash(HTAB *, char *, size_t);
int dbm_delpair(HTAB *, BUFHEAD *, int);
int dbm_expand_table(HTAB *);
int dbm_find_bigpair(HTAB *, BUFHEAD *, int, char *, int);
uint16 dbm_find_last_page(HTAB *, BUFHEAD **);
void dbm_free_ovflpage(HTAB *, BUFHEAD *);
BUFHEAD *dbm_get_buf(HTAB *, uint32, BUFHEAD *, int);
int dbm_get_page(HTAB *, char *, uint32, int, int, int);
int dbm_ibitmap(HTAB *, int, int, int);
uint32 dbm_log2(uint32);
int dbm_put_page(HTAB *, char *, uint32, int, int);
void dbm_reclaim_buf(HTAB *, BUFHEAD *);
int dbm_split_page(HTAB *, uint32, uint32);

/* Default hash routine. */
extern uint32 (*__default_hash)(const void *, size_t);
extern uint32 (*dbm_default_hash)(const void *, size_t);

#ifdef HASH_STATISTICS
extern int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
Expand Down
50 changes: 25 additions & 25 deletions lib/dbm/include/hash.h
Expand Up @@ -190,7 +190,7 @@ typedef struct htab { /* Memory resident data structure */
#define OADDR_OF(S, O) ((uint32)((uint32)(S) << SPLITSHIFT) + (O))

#define BUCKET_TO_PAGE(B) \
(B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((uint32)((B) + 1)) - 1] : 0)
(B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[dbm_log2((uint32)((B) + 1)) - 1] : 0)
#define OADDR_TO_PAGE(B) \
BUCKET_TO_PAGE((1 << SPLITNUM((B))) - 1) + OPAGENUM((B));

Expand Down Expand Up @@ -314,28 +314,28 @@ typedef struct htab { /* Memory resident data structure */
#define NEXT_FREE hdr.next_free
#define H_CHARKEY hdr.h_charkey

extern uint32 (*__default_hash)(const void *, size_t);
void __buf_init(HTAB *hashp, int32 nbytes);
int __big_delete(HTAB *hashp, BUFHEAD *bufp);
BUFHEAD *__get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage);
uint32 __call_hash(HTAB *hashp, char *k, size_t len);
extern uint32 (*dbm_default_hash)(const void *, size_t);
void dbm_buf_init(HTAB *hashp, int32 nbytes);
int dbm_big_delete(HTAB *hashp, BUFHEAD *bufp);
BUFHEAD *dbm_get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage);
uint32 dbm_call_hash(HTAB *hashp, char *k, size_t len);
#include "page.h"
extern int __big_split(HTAB *hashp, BUFHEAD *op, BUFHEAD *np,
BUFHEAD *big_keyp, uint32 addr, uint32 obucket, SPLIT_RETURN *ret);
void __free_ovflpage(HTAB *hashp, BUFHEAD *obufp);
BUFHEAD *__add_ovflpage(HTAB *hashp, BUFHEAD *bufp);
int __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
int __expand_table(HTAB *hashp);
uint32 __log2(uint32 num);
void __reclaim_buf(HTAB *hashp, BUFHEAD *bp);
int __get_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_disk, int is_bitmap);
int __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap);
int __ibitmap(HTAB *hashp, int pnum, int nbits, int ndx);
int __buf_free(HTAB *hashp, int do_free, int to_disk);
int __find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size);
uint16 __find_last_page(HTAB *hashp, BUFHEAD **bpp);
int __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
int __big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current);
int __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx);
int __big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set);
int __split_page(HTAB *hashp, uint32 obucket, uint32 nbucket);
extern int dbm_big_split(HTAB *hashp, BUFHEAD *op, BUFHEAD *np,
BUFHEAD *big_keyp, uint32 addr, uint32 obucket, SPLIT_RETURN *ret);
void dbm_free_ovflpage(HTAB *hashp, BUFHEAD *obufp);
BUFHEAD *dbm_add_ovflpage(HTAB *hashp, BUFHEAD *bufp);
int dbm_big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
int dbm_expand_table(HTAB *hashp);
uint32 dbm_log2(uint32 num);
void dbm_reclaim_buf(HTAB *hashp, BUFHEAD *bp);
int dbm_get_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_disk, int is_bitmap);
int dbm_put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap);
int dbm_ibitmap(HTAB *hashp, int pnum, int nbits, int ndx);
int dbm_buf_free(HTAB *hashp, int do_free, int to_disk);
int dbm_find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size);
uint16 dbm_find_last_page(HTAB *hashp, BUFHEAD **bpp);
int dbm_addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val);
int dbm_big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current);
int dbm_delpair(HTAB *hashp, BUFHEAD *bufp, int ndx);
int dbm_big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set);
int dbm_split_page(HTAB *hashp, uint32 obucket, uint32 nbucket);
24 changes: 12 additions & 12 deletions lib/dbm/include/mcom_db.h
Expand Up @@ -287,16 +287,16 @@ typedef enum { LockOutDatabase,
#endif

/* Access method description structure. */
typedef struct __db {
typedef struct dbm_db {
DBTYPE type; /* Underlying db type. */
int (*close)(struct __db *);
int (*del)(const struct __db *, const DBT *, uint);
int (*get)(const struct __db *, const DBT *, DBT *, uint);
int (*put)(const struct __db *, DBT *, const DBT *, uint);
int (*seq)(const struct __db *, DBT *, DBT *, uint);
int (*sync)(const struct __db *, uint);
int (*close)(struct dbm_db *);
int (*del)(const struct dbm_db *, const DBT *, uint);
int (*get)(const struct dbm_db *, const DBT *, DBT *, uint);
int (*put)(const struct dbm_db *, DBT *, const DBT *, uint);
int (*seq)(const struct dbm_db *, DBT *, DBT *, uint);
int (*sync)(const struct dbm_db *, uint);
void *internal; /* Access method private. */
int (*fd)(const struct __db *);
int (*fd)(const struct dbm_db *);
} DB;

#define BTREEMAGIC 0x053162
Expand Down Expand Up @@ -412,10 +412,10 @@ dbopen(const char *, int, int, DBTYPE, const void *);
void dbSetOrClearDBLock(DBLockFlagEnum type);

#ifdef __DBINTERFACE_PRIVATE
DB *__bt_open(const char *, int, int, const BTREEINFO *, int);
DB *__hash_open(const char *, int, int, const HASHINFO *, int);
DB *__rec_open(const char *, int, int, const RECNOINFO *, int);
void __dbpanic(DB *dbp);
DB *dbm_bt_open(const char *, int, int, const BTREEINFO *, int);
DB *dbm_hash_open(const char *, int, int, const HASHINFO *, int);
DB *dbm_rec_open(const char *, int, int, const RECNOINFO *, int);
void dbm_dbpanic(DB *dbp);
#endif

PR_END_EXTERN_C
Expand Down
6 changes: 3 additions & 3 deletions lib/dbm/include/ncompat.h
Expand Up @@ -89,13 +89,13 @@ typedef unsigned int sigset_t;
#define SIG_UNBLOCK 2
#define SIG_SETMASK 3

static int __sigtemp; /* For the use of sigprocmask */
static int dbm_sigtemp; /* For the use of sigprocmask */

/* Repeated test of oset != NULL is to avoid "*0". */
#define sigprocmask(how, set, oset) \
((__sigtemp = \
((dbm_sigtemp = \
(((how) == SIG_BLOCK) ? sigblock(0) | *(set) : (((how) == SIG_UNBLOCK) ? sigblock(0) & ~(*(set)) : ((how) == SIG_SETMASK ? *(set) : sigblock(0))))), \
((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : sigsetmask(__sigtemp)), 0)
((oset) ? (*(oset ? oset : set) = sigsetmask(dbm_sigtemp)) : sigsetmask(dbm_sigtemp)), 0)
#endif

/*
Expand Down
24 changes: 12 additions & 12 deletions lib/dbm/src/db.c
Expand Up @@ -92,16 +92,16 @@ dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo
/* we don't need btree and recno right now */
#if 0
case DB_BTREE:
return (__bt_open(fname, flags & USE_OPEN_FLAGS,
return (dbm_bt_open(fname, flags & USE_OPEN_FLAGS,
mode, openinfo, flags & DB_FLAGS));
case DB_RECNO:
return (__rec_open(fname, flags & USE_OPEN_FLAGS,
return (dbm_rec_open(fname, flags & USE_OPEN_FLAGS,
mode, openinfo, flags & DB_FLAGS));
#endif

case DB_HASH:
return (__hash_open(fname, flags & USE_OPEN_FLAGS,
mode, (const HASHINFO *)openinfo, flags & DB_FLAGS));
return (dbm_hash_open(fname, flags & USE_OPEN_FLAGS,
mode, (const HASHINFO *)openinfo, flags & DB_FLAGS));
default:
break;
}
Expand All @@ -110,7 +110,7 @@ dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo
}

static int
__dberr()
dbm_dberr()
{
return (RET_ERROR);
}
Expand All @@ -122,13 +122,13 @@ __dberr()
* dbp: pointer to the DB structure.
*/
void
__dbpanic(DB *dbp)
dbm_dbpanic(DB *dbp)
{
/* The only thing that can succeed is a close. */
dbp->del = (int (*)(const struct __db *, const DBT *, uint))__dberr;
dbp->fd = (int (*)(const struct __db *))__dberr;
dbp->get = (int (*)(const struct __db *, const DBT *, DBT *, uint))__dberr;
dbp->put = (int (*)(const struct __db *, DBT *, const DBT *, uint))__dberr;
dbp->seq = (int (*)(const struct __db *, DBT *, DBT *, uint))__dberr;
dbp->sync = (int (*)(const struct __db *, uint))__dberr;
dbp->del = (int (*)(const struct dbm_db *, const DBT *, uint))dbm_dberr;
dbp->fd = (int (*)(const struct dbm_db *))dbm_dberr;
dbp->get = (int (*)(const struct dbm_db *, const DBT *, DBT *, uint))dbm_dberr;
dbp->put = (int (*)(const struct dbm_db *, DBT *, const DBT *, uint))dbm_dberr;
dbp->seq = (int (*)(const struct dbm_db *, DBT *, DBT *, uint))dbm_dberr;
dbp->sync = (int (*)(const struct dbm_db *, uint))dbm_dberr;
}

0 comments on commit b9dad25

Please sign in to comment.