From fca7c45a62542e0f625122222386cbee9b76243f Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 18:26:54 -0500 Subject: MoonchildProductions#1251 - Part 16: Resolve namespace conflicts with dbm on Solaris. https://bugzilla.mozilla.org/show_bug.cgi?id=1513913 Mozilla's solution to this is arguably overkill, since the namespace issue on Solaris only required them to change (or temporarily undefine) __log2. Instead they changed ALL the functions to be something along the lines of dbm_log2. They haven't changed the external interface at all, though. If you're unhappy with this patch, I think I could also use XP_SOLARIS ifdefs to undefine __log2 prior to where it's declared in the dbm headers. The good thing about Mozilla's solution is that it guarantees this namespace issue never occurs again on any platform, though. --- security/nss/lib/dbm/include/hash.h | 50 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'security/nss/lib/dbm/include/hash.h') diff --git a/security/nss/lib/dbm/include/hash.h b/security/nss/lib/dbm/include/hash.h index 7da51dc64..0ce3c3ff2 100644 --- a/security/nss/lib/dbm/include/hash.h +++ b/security/nss/lib/dbm/include/hash.h @@ -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)); @@ -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); -- cgit v1.2.3