Alexander Pyhalov
2013-12-26 19364bc98e54de97ee80f4a687e3aa42d547eced
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
__log2 name conflicts with function in libm, 
and so incorrect function is used.
 
 
--- mozilla-esr17/dbm/include/hash.h.~1~    2014-01-08 13:57:04.786935370 +0400
+++ mozilla-esr17/dbm/include/hash.h    2014-01-08 13:57:47.761094206 +0400
@@ -184,7 +184,7 @@
 #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[__nss_log2((uint32)((B)+1))-1] : 0)
 #define OADDR_TO_PAGE(B)     \
     BUCKET_TO_PAGE ( (1 << SPLITNUM((B))) -1 ) + OPAGENUM((B));
 
@@ -320,7 +320,7 @@
 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);
+uint32 __nss_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);
--- mozilla-esr17/dbm/include/extern.h.~1~    2014-01-08 13:58:28.606082545 +0400
+++ mozilla-esr17/dbm/include/extern.h    2014-01-08 13:58:55.929964800 +0400
@@ -50,7 +50,7 @@
 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);
+uint32     __nss_log2 (uint32);
 int     __put_page (HTAB *, char *, uint32, int, int);
 void     __reclaim_buf (HTAB *, BUFHEAD *);
 int     __split_page (HTAB *, uint32, uint32);
--- mozilla-esr17/dbm/src/h_log2.c.~1~    2014-01-08 13:59:33.187926843 +0400
+++ mozilla-esr17/dbm/src/h_log2.c    2014-01-08 14:00:05.657990538 +0400
@@ -42,7 +42,7 @@
 #endif
 #include "mcom_db.h"
 
-uint32 __log2(uint32 num)
+uint32 __nss_log2(uint32 num)
 {
     register uint32 i, limit;
 
--- mozilla-esr17/dbm/src/hash.c.~1~    2014-01-08 14:01:00.646942634 +0400
+++ mozilla-esr17/dbm/src/hash.c    2014-01-08 14:01:16.017066043 +0400
@@ -352,13 +352,13 @@
         if (hashp->BSIZE > MAX_BSIZE)
             hashp->BSIZE = MAX_BSIZE;
 #endif
-        hashp->BSHIFT = __log2((uint32)hashp->BSIZE);
+        hashp->BSHIFT = __nss_log2((uint32)hashp->BSIZE);
     }
 
     if (info) {
         if (info->bsize) {
             /* Round pagesize up to power of 2 */
-            hashp->BSHIFT = __log2(info->bsize);
+            hashp->BSHIFT = __nss_log2(info->bsize);
             hashp->BSIZE = 1 << hashp->BSHIFT;
             if (hashp->BSIZE > MAX_BSIZE) {
                 errno = EINVAL;
@@ -405,7 +405,7 @@
      */
     nelem = (nelem - 1) / hashp->FFACTOR + 1;
 
-    l2 = __log2((uint32)PR_MAX(nelem, 2));
+    l2 = __nss_log2((uint32)PR_MAX(nelem, 2));
     nbuckets = 1 << l2;
 
     hashp->SPARES[l2] = l2 + 1;
@@ -423,7 +423,7 @@
         hashp->BSHIFT) + 1;
 
     nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
-    nsegs = 1 << __log2((uint32)nsegs);
+    nsegs = 1 << __nss_log2((uint32)nsegs);
 
     if (nsegs > hashp->DSIZE)
         hashp->DSIZE = nsegs;
@@ -1033,7 +1033,7 @@
      * * increases), we need to copy the current contents of the spare
      * split bucket to the next bucket.
      */
-    spare_ndx = __log2((uint32)(hashp->MAX_BUCKET + 1));
+    spare_ndx = __nss_log2((uint32)(hashp->MAX_BUCKET + 1));
     if (spare_ndx > hashp->OVFL_POINT) {
         hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
         hashp->OVFL_POINT = spare_ndx;