home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1992-04-05 | 12.1 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, Sun Apr 5 13:59:15 1992, modified Sun Apr 5 13:59:15 1992, creator 'MPS ', type ASCII, 11668 bytes "falloc.c" , at 0x2e14 428 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 66 61 6c 6c 6f 63 | 2e 63 00 00 00 00 00 00 |..falloc|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 2d 94 00 | 00 01 ac a6 04 f0 73 a6 |.....-..|......s.|
|00000060| 04 f0 73 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..s.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 e5 bd 00 00 |........|........|
|00000080| 2f 2a 20 66 61 6c 6c 6f | 63 2e 63 20 2d 20 54 68 |/* fallo|c.c - Th|
|00000090| 65 20 66 69 6c 65 20 73 | 70 61 63 65 20 6d 61 6e |e file s|pace man|
|000000a0| 61 67 65 6d 65 6e 74 20 | 72 6f 75 74 69 6e 65 73 |agement |routines|
|000000b0| 20 66 6f 72 20 64 62 6d | 2e 20 2a 2f 0d 0d 2f 2a | for dbm|. */../*|
|000000c0| 20 20 54 68 69 73 20 66 | 69 6c 65 20 69 73 20 70 | This f|ile is p|
|000000d0| 61 72 74 20 6f 66 20 47 | 44 42 4d 2c 20 74 68 65 |art of G|DBM, the|
|000000e0| 20 47 4e 55 20 64 61 74 | 61 20 62 61 73 65 20 6d | GNU dat|a base m|
|000000f0| 61 6e 61 67 65 72 2c 20 | 62 79 20 50 68 69 6c 69 |anager, |by Phili|
|00000100| 70 20 41 2e 20 4e 65 6c | 73 6f 6e 2e 0d 20 20 20 |p A. Nel|son.. |
|00000110| 20 43 6f 70 79 72 69 67 | 68 74 20 28 43 29 20 31 | Copyrig|ht (C) 1|
|00000120| 39 39 30 2c 20 31 39 39 | 31 20 20 46 72 65 65 20 |990, 199|1 Free |
|00000130| 53 6f 66 74 77 61 72 65 | 20 46 6f 75 6e 64 61 74 |Software| Foundat|
|00000140| 69 6f 6e 2c 20 49 6e 63 | 2e 0d 0d 20 20 20 20 47 |ion, Inc|... G|
|00000150| 44 42 4d 20 69 73 20 66 | 72 65 65 20 73 6f 66 74 |DBM is f|ree soft|
|00000160| 77 61 72 65 3b 20 79 6f | 75 20 63 61 6e 20 72 65 |ware; yo|u can re|
|00000170| 64 69 73 74 72 69 62 75 | 74 65 20 69 74 20 61 6e |distribu|te it an|
|00000180| 64 2f 6f 72 20 6d 6f 64 | 69 66 79 0d 20 20 20 20 |d/or mod|ify. |
|00000190| 69 74 20 75 6e 64 65 72 | 20 74 68 65 20 74 65 72 |it under| the ter|
|000001a0| 6d 73 20 6f 66 20 74 68 | 65 20 47 4e 55 20 47 65 |ms of th|e GNU Ge|
|000001b0| 6e 65 72 61 6c 20 50 75 | 62 6c 69 63 20 4c 69 63 |neral Pu|blic Lic|
|000001c0| 65 6e 73 65 20 61 73 20 | 70 75 62 6c 69 73 68 65 |ense as |publishe|
|000001d0| 64 20 62 79 0d 20 20 20 | 20 74 68 65 20 46 72 65 |d by. | the Fre|
|000001e0| 65 20 53 6f 66 74 77 61 | 72 65 20 46 6f 75 6e 64 |e Softwa|re Found|
|000001f0| 61 74 69 6f 6e 3b 20 65 | 69 74 68 65 72 20 76 65 |ation; e|ither ve|
|00000200| 72 73 69 6f 6e 20 31 2c | 20 6f 72 20 28 61 74 20 |rsion 1,| or (at |
|00000210| 79 6f 75 72 20 6f 70 74 | 69 6f 6e 29 0d 20 20 20 |your opt|ion). |
|00000220| 20 61 6e 79 20 6c 61 74 | 65 72 20 76 65 72 73 69 | any lat|er versi|
|00000230| 6f 6e 2e 0d 0d 20 20 20 | 20 47 44 42 4d 20 69 73 |on... | GDBM is|
|00000240| 20 64 69 73 74 72 69 62 | 75 74 65 64 20 69 6e 20 | distrib|uted in |
|00000250| 74 68 65 20 68 6f 70 65 | 20 74 68 61 74 20 69 74 |the hope| that it|
|00000260| 20 77 69 6c 6c 20 62 65 | 20 75 73 65 66 75 6c 2c | will be| useful,|
|00000270| 0d 20 20 20 20 62 75 74 | 20 57 49 54 48 4f 55 54 |. but| WITHOUT|
|00000280| 20 41 4e 59 20 57 41 52 | 52 41 4e 54 59 3b 20 77 | ANY WAR|RANTY; w|
|00000290| 69 74 68 6f 75 74 20 65 | 76 65 6e 20 74 68 65 20 |ithout e|ven the |
|000002a0| 69 6d 70 6c 69 65 64 20 | 77 61 72 72 61 6e 74 79 |implied |warranty|
|000002b0| 20 6f 66 0d 20 20 20 20 | 4d 45 52 43 48 41 4e 54 | of. |MERCHANT|
|000002c0| 41 42 49 4c 49 54 59 20 | 6f 72 20 46 49 54 4e 45 |ABILITY |or FITNE|
|000002d0| 53 53 20 46 4f 52 20 41 | 20 50 41 52 54 49 43 55 |SS FOR A| PARTICU|
|000002e0| 4c 41 52 20 50 55 52 50 | 4f 53 45 2e 20 20 53 65 |LAR PURP|OSE. Se|
|000002f0| 65 20 74 68 65 0d 20 20 | 20 20 47 4e 55 20 47 65 |e the. | GNU Ge|
|00000300| 6e 65 72 61 6c 20 50 75 | 62 6c 69 63 20 4c 69 63 |neral Pu|blic Lic|
|00000310| 65 6e 73 65 20 66 6f 72 | 20 6d 6f 72 65 20 64 65 |ense for| more de|
|00000320| 74 61 69 6c 73 2e 0d 0d | 20 20 20 20 59 6f 75 20 |tails...| You |
|00000330| 73 68 6f 75 6c 64 20 68 | 61 76 65 20 72 65 63 65 |should h|ave rece|
|00000340| 69 76 65 64 20 61 20 63 | 6f 70 79 20 6f 66 20 74 |ived a c|opy of t|
|00000350| 68 65 20 47 4e 55 20 47 | 65 6e 65 72 61 6c 20 50 |he GNU G|eneral P|
|00000360| 75 62 6c 69 63 20 4c 69 | 63 65 6e 73 65 0d 20 20 |ublic Li|cense. |
|00000370| 20 20 61 6c 6f 6e 67 20 | 77 69 74 68 20 47 44 42 | along |with GDB|
|00000380| 4d 3b 20 73 65 65 20 74 | 68 65 20 66 69 6c 65 20 |M; see t|he file |
|00000390| 43 4f 50 59 49 4e 47 2e | 20 20 49 66 20 6e 6f 74 |COPYING.| If not|
|000003a0| 2c 20 77 72 69 74 65 20 | 74 6f 0d 20 20 20 20 74 |, write |to. t|
|000003b0| 68 65 20 46 72 65 65 20 | 53 6f 66 74 77 61 72 65 |he Free |Software|
|000003c0| 20 46 6f 75 6e 64 61 74 | 69 6f 6e 2c 20 36 37 35 | Foundat|ion, 675|
|000003d0| 20 4d 61 73 73 20 41 76 | 65 2c 20 43 61 6d 62 72 | Mass Av|e, Cambr|
|000003e0| 69 64 67 65 2c 20 4d 41 | 20 30 32 31 33 39 2c 20 |idge, MA| 02139, |
|000003f0| 55 53 41 2e 0d 0d 20 20 | 20 20 59 6f 75 20 6d 61 |USA... | You ma|
|00000400| 79 20 63 6f 6e 74 61 63 | 74 20 74 68 65 20 61 75 |y contac|t the au|
|00000410| 74 68 6f 72 20 62 79 3a | 0d 20 20 20 20 20 20 20 |thor by:|. |
|00000420| 65 2d 6d 61 69 6c 3a 20 | 20 70 68 69 6c 40 63 73 |e-mail: | phil@cs|
|00000430| 2e 77 77 75 2e 65 64 75 | 0d 20 20 20 20 20 20 75 |.wwu.edu|. u|
|00000440| 73 2d 6d 61 69 6c 3a 20 | 20 50 68 69 6c 69 70 20 |s-mail: | Philip |
|00000450| 41 2e 20 4e 65 6c 73 6f | 6e 0d 20 20 20 20 20 20 |A. Nelso|n. |
|00000460| 20 20 20 20 20 20 20 20 | 20 20 43 6f 6d 70 75 74 | | Comput|
|00000470| 65 72 20 53 63 69 65 6e | 63 65 20 44 65 70 61 72 |er Scien|ce Depar|
|00000480| 74 6d 65 6e 74 0d 20 20 | 20 20 20 20 20 20 20 20 |tment. | |
|00000490| 20 20 20 20 20 20 57 65 | 73 74 65 72 6e 20 57 61 | We|stern Wa|
|000004a0| 73 68 69 6e 67 74 6f 6e | 20 55 6e 69 76 65 72 73 |shington| Univers|
|000004b0| 69 74 79 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ity. | |
|000004c0| 20 20 20 20 42 65 6c 6c | 69 6e 67 68 61 6d 2c 20 | Bell|ingham, |
|000004d0| 57 41 20 39 38 32 32 36 | 0d 20 20 20 20 20 20 20 |WA 98226|. |
|000004e0| 20 70 68 6f 6e 65 3a 20 | 20 28 32 30 36 29 20 36 | phone: | (206) 6|
|000004f0| 37 36 2d 33 30 33 35 0d | 20 20 20 20 20 20 20 0d |76-3035.| .|
|00000500| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000510| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000520| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000530| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000540| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2f 0d 0d 23 69 6e 63 |********|*/..#inc|
|00000550| 6c 75 64 65 20 22 67 64 | 62 6d 64 65 66 73 2e 68 |lude "gd|bmdefs.h|
|00000560| 22 0d 0d 0d 2f 2a 20 54 | 68 65 20 66 6f 72 77 61 |".../* T|he forwa|
|00000570| 72 64 20 64 65 66 69 6e | 69 74 69 6f 6e 73 20 66 |rd defin|itions f|
|00000580| 6f 72 20 74 68 69 73 20 | 66 69 6c 65 2e 20 20 53 |or this |file. S|
|00000590| 65 65 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 73 |ee the f|unctions|
|000005a0| 20 66 6f 72 0d 20 20 20 | 74 68 65 20 64 65 66 69 | for. |the defi|
|000005b0| 6e 69 74 69 6f 6e 20 6f | 66 20 74 68 65 20 66 75 |nition o|f the fu|
|000005c0| 6e 63 74 69 6f 6e 2e 20 | 2a 2f 0d 0d 73 74 61 74 |nction. |*/..stat|
|000005d0| 69 63 20 61 76 61 69 6c | 5f 65 6c 65 6d 20 67 65 |ic avail|_elem ge|
|000005e0| 74 5f 65 6c 65 6d 20 28 | 29 3b 0d 73 74 61 74 69 |t_elem (|);.stati|
|000005f0| 63 20 61 76 61 69 6c 5f | 65 6c 65 6d 20 67 65 74 |c avail_|elem get|
|00000600| 5f 62 6c 6f 63 6b 20 28 | 29 3b 0d 73 74 61 74 69 |_block (|);.stati|
|00000610| 63 20 70 75 73 68 5f 61 | 76 61 69 6c 5f 62 6c 6f |c push_a|vail_blo|
|00000620| 63 6b 20 28 29 3b 0d 73 | 74 61 74 69 63 20 70 6f |ck ();.s|tatic po|
|00000630| 70 5f 61 76 61 69 6c 5f | 62 6c 6f 63 6b 20 28 29 |p_avail_|block ()|
|00000640| 3b 0d 73 74 61 74 69 63 | 20 61 64 6a 75 73 74 5f |;.static| adjust_|
|00000650| 62 75 63 6b 65 74 5f 61 | 76 61 69 6c 20 28 29 3b |bucket_a|vail ();|
|00000660| 0d 0d 2f 2a 20 41 6c 6c | 6f 63 61 74 65 20 73 70 |../* All|ocate sp|
|00000670| 61 63 65 20 69 6e 20 74 | 68 65 20 66 69 6c 65 20 |ace in t|he file |
|00000680| 44 42 46 20 66 6f 72 20 | 61 20 62 6c 6f 63 6b 20 |DBF for |a block |
|00000690| 4e 55 4d 5f 42 59 54 45 | 53 20 69 6e 20 6c 65 6e |NUM_BYTE|S in len|
|000006a0| 67 74 68 2e 20 20 52 65 | 74 75 72 6e 0d 20 20 20 |gth. Re|turn. |
|000006b0| 74 68 65 20 66 69 6c 65 | 20 61 64 64 72 65 73 73 |the file| address|
|000006c0| 20 6f 66 20 74 68 65 20 | 73 74 61 72 74 20 6f 66 | of the |start of|
|000006d0| 20 74 68 65 20 62 6c 6f | 63 6b 2e 20 20 0d 0d 20 | the blo|ck. .. |
|000006e0| 20 20 45 61 63 68 20 68 | 61 73 68 20 62 75 63 6b | Each h|ash buck|
|000006f0| 65 74 20 68 61 73 20 61 | 20 66 69 78 65 64 20 73 |et has a| fixed s|
|00000700| 69 7a 65 20 61 76 61 69 | 6c 20 74 61 62 6c 65 2e |ize avai|l table.|
|00000710| 20 20 57 65 20 66 69 72 | 73 74 20 63 68 65 63 6b | We fir|st check|
|00000720| 20 74 68 69 73 0d 20 20 | 20 61 76 61 69 6c 20 74 | this. | avail t|
|00000730| 61 62 6c 65 20 74 6f 20 | 73 61 74 69 73 66 79 20 |able to |satisfy |
|00000740| 74 68 65 20 72 65 71 75 | 65 73 74 20 66 6f 72 20 |the requ|est for |
|00000750| 73 70 61 63 65 2e 20 20 | 49 6e 20 6d 6f 73 74 20 |space. |In most |
|00000760| 63 61 73 65 73 20 77 65 | 20 63 61 6e 0d 20 20 20 |cases we| can. |
|00000770| 61 6e 64 20 74 68 69 73 | 20 63 61 75 73 65 73 20 |and this| causes |
|00000780| 63 68 61 6e 67 65 73 20 | 74 6f 20 62 65 20 6f 6e |changes |to be on|
|00000790| 6c 79 20 69 6e 20 74 68 | 65 20 63 75 72 72 65 6e |ly in th|e curren|
|000007a0| 74 20 68 61 73 68 20 62 | 75 63 6b 65 74 2e 0d 20 |t hash b|ucket.. |
|000007b0| 20 20 41 6c 6c 6f 63 61 | 74 69 6f 6e 20 69 73 20 | Alloca|tion is |
|000007c0| 64 6f 6e 65 20 6f 6e 20 | 61 20 66 69 72 73 74 20 |done on |a first |
|000007d0| 66 69 74 20 62 61 73 69 | 73 20 66 72 6f 6d 20 74 |fit basi|s from t|
|000007e0| 68 65 20 65 6e 74 72 69 | 65 73 2e 20 20 49 66 20 |he entri|es. If |
|000007f0| 61 0d 20 20 20 72 65 71 | 75 65 73 74 20 63 61 6e |a. req|uest can|
|00000800| 20 6e 6f 74 20 62 65 20 | 73 61 74 69 73 66 69 65 | not be |satisfie|
|00000810| 64 20 66 72 6f 6d 20 74 | 68 65 20 63 75 72 72 65 |d from t|he curre|
|00000820| 6e 74 20 68 61 73 68 20 | 62 75 63 6b 65 74 2c 20 |nt hash |bucket, |
|00000830| 74 68 65 6e 20 69 74 20 | 69 73 0d 20 20 20 73 61 |then it |is. sa|
|00000840| 74 69 73 66 69 65 64 20 | 66 72 6f 6d 20 74 68 65 |tisfied |from the|
|00000850| 20 66 69 6c 65 20 68 65 | 61 64 65 72 20 61 76 61 | file he|ader ava|
|00000860| 69 6c 20 62 6c 6f 63 6b | 2e 20 20 49 66 20 6e 6f |il block|. If no|
|00000870| 74 68 69 6e 67 20 69 73 | 20 74 68 65 72 65 20 74 |thing is| there t|
|00000880| 68 61 74 0d 20 20 20 68 | 61 73 20 65 6e 6f 75 67 |hat. h|as enoug|
|00000890| 68 20 73 70 61 63 65 2c | 20 61 6e 6f 74 68 65 72 |h space,| another|
|000008a0| 20 62 6c 6f 63 6b 20 61 | 74 20 74 68 65 20 65 6e | block a|t the en|
|000008b0| 64 20 6f 66 20 74 68 65 | 20 66 69 6c 65 20 69 73 |d of the| file is|
|000008c0| 20 61 6c 6c 6f 63 61 74 | 65 64 0d 20 20 20 61 6e | allocat|ed. an|
|000008d0| 64 20 74 68 65 20 75 6e | 75 73 65 64 20 70 6f 72 |d the un|used por|
|000008e0| 74 69 6f 6e 20 69 73 20 | 72 65 74 75 72 6e 65 64 |tion is |returned|
|000008f0| 20 74 6f 20 74 68 65 20 | 61 76 61 69 6c 20 62 6c | to the |avail bl|
|00000900| 6f 63 6b 2e 20 20 54 68 | 69 73 20 72 6f 75 74 69 |ock. Th|is routi|
|00000910| 6e 65 0d 20 20 20 22 67 | 75 61 72 61 6e 74 65 65 |ne. "g|uarantee|
|00000920| 73 22 20 74 68 61 74 20 | 61 6e 20 61 6c 6c 6f 63 |s" that |an alloc|
|00000930| 61 74 69 6f 6e 20 64 6f | 65 73 20 6e 6f 74 20 63 |ation do|es not c|
|00000940| 72 6f 73 73 20 61 20 62 | 6c 6f 63 6b 20 62 6f 75 |ross a b|lock bou|
|00000950| 6e 64 61 72 79 20 75 6e | 6c 65 73 73 0d 20 20 20 |ndary un|less. |
|00000960| 74 68 65 20 73 69 7a 65 | 20 69 73 20 6c 61 72 67 |the size| is larg|
|00000970| 65 72 20 74 68 61 6e 20 | 61 20 73 69 6e 67 6c 65 |er than |a single|
|00000980| 20 62 6c 6f 63 6b 2e 20 | 20 54 68 65 20 61 76 61 | block. | The ava|
|00000990| 69 6c 20 73 74 72 75 63 | 74 75 72 65 20 69 73 0d |il struc|ture is.|
|000009a0| 20 20 20 63 68 61 6e 67 | 65 64 20 62 79 20 74 68 | chang|ed by th|
|000009b0| 69 73 20 72 6f 75 74 69 | 6e 65 20 69 66 20 61 20 |is routi|ne if a |
|000009c0| 63 68 61 6e 67 65 20 69 | 73 20 6e 65 65 64 65 64 |change i|s needed|
|000009d0| 2e 20 20 49 66 20 61 6e | 20 65 72 72 6f 72 20 6f |. If an| error o|
|000009e0| 63 63 75 72 73 2c 0d 20 | 20 20 74 68 65 20 76 61 |ccurs,. | the va|
|000009f0| 6c 75 65 20 6f 66 20 30 | 20 77 69 6c 6c 20 62 65 |lue of 0| will be|
|00000a00| 20 72 65 74 75 72 6e 65 | 64 2e 20 20 2a 2f 0d 0d | returne|d. */..|
|00000a10| 6c 6f 6e 67 0d 5f 67 64 | 62 6d 5f 61 6c 6c 6f 63 |long._gd|bm_alloc|
|00000a20| 20 28 64 62 66 2c 20 6e | 75 6d 5f 62 79 74 65 73 | (dbf, n|um_bytes|
|00000a30| 29 0d 20 20 20 20 20 67 | 64 62 6d 5f 66 69 6c 65 |). g|dbm_file|
|00000a40| 5f 69 6e 66 6f 20 2a 64 | 62 66 3b 0d 20 20 20 20 |_info *d|bf;. |
|00000a50| 20 69 6e 74 20 6e 75 6d | 5f 62 79 74 65 73 3b 0d | int num|_bytes;.|
|00000a60| 7b 0d 20 20 6c 6f 6e 67 | 20 20 66 69 6c 65 5f 61 |{. long| file_a|
|00000a70| 64 72 3b 09 09 2f 2a 20 | 54 68 65 20 61 64 64 72 |dr;../* |The addr|
|00000a80| 65 73 73 20 6f 66 20 74 | 68 65 20 62 6c 6f 63 6b |ess of t|he block|
|00000a90| 2e 20 2a 2f 0d 20 20 61 | 76 61 69 6c 5f 65 6c 65 |. */. a|vail_ele|
|00000aa0| 6d 20 61 76 5f 65 6c 3b | 09 09 2f 2a 20 46 6f 72 |m av_el;|../* For|
|00000ab0| 20 74 65 6d 70 6f 72 61 | 72 79 20 75 73 65 2e 20 | tempora|ry use. |
|00000ac0| 2a 2f 0d 0d 20 20 2f 2a | 20 54 68 65 20 63 75 72 |*/.. /*| The cur|
|00000ad0| 72 65 6e 74 20 62 75 63 | 6b 65 74 20 69 73 20 74 |rent buc|ket is t|
|00000ae0| 68 65 20 66 69 72 73 74 | 20 70 6c 61 63 65 20 74 |he first| place t|
|00000af0| 6f 20 6c 6f 6f 6b 20 66 | 6f 72 20 73 70 61 63 65 |o look f|or space|
|00000b00| 2e 20 2a 2f 0d 20 20 61 | 76 5f 65 6c 20 3d 20 67 |. */. a|v_el = g|
|00000b10| 65 74 5f 65 6c 65 6d 20 | 28 6e 75 6d 5f 62 79 74 |et_elem |(num_byt|
|00000b20| 65 73 2c 20 64 62 66 2d | 3e 62 75 63 6b 65 74 2d |es, dbf-|>bucket-|
|00000b30| 3e 62 75 63 6b 65 74 5f | 61 76 61 69 6c 2c 0d 09 |>bucket_|avail,..|
|00000b40| 09 20 20 20 20 26 64 62 | 66 2d 3e 62 75 63 6b 65 |. &db|f->bucke|
|00000b50| 74 2d 3e 61 76 5f 63 6f | 75 6e 74 29 3b 0d 0d 20 |t->av_co|unt);.. |
|00000b60| 20 2f 2a 20 49 66 20 77 | 65 20 64 69 64 20 6e 6f | /* If w|e did no|
|00000b70| 74 20 66 69 6e 64 20 73 | 6f 6d 65 20 73 70 61 63 |t find s|ome spac|
|00000b80| 65 2c 20 77 65 20 68 61 | 76 65 20 6d 6f 72 65 20 |e, we ha|ve more |
|00000b90| 77 6f 72 6b 20 74 6f 20 | 64 6f 2e 20 2a 2f 0d 20 |work to |do. */. |
|00000ba0| 20 69 66 20 28 61 76 5f | 65 6c 2e 61 76 5f 73 69 | if (av_|el.av_si|
|00000bb0| 7a 65 20 3d 3d 20 30 29 | 0d 20 20 20 20 7b 0d 20 |ze == 0)|. {. |
|00000bc0| 20 20 20 20 2f 2a 20 49 | 73 20 74 68 65 20 68 65 | /* I|s the he|
|00000bd0| 61 64 65 72 20 61 76 61 | 69 6c 20 62 6c 6f 63 6b |ader ava|il block|
|00000be0| 20 65 6d 70 74 79 20 61 | 6e 64 20 74 68 65 72 65 | empty a|nd there|
|00000bf0| 20 69 73 20 73 6f 6d 65 | 74 68 69 6e 67 20 6f 6e | is some|thing on|
|00000c00| 20 74 68 65 20 73 74 61 | 63 6b 2e 20 2a 2f 0d 20 | the sta|ck. */. |
|00000c10| 20 20 20 20 20 69 66 20 | 28 64 62 66 2d 3e 68 65 | if |(dbf->he|
|00000c20| 61 64 65 72 2d 3e 61 76 | 61 69 6c 2e 63 6f 75 6e |ader->av|ail.coun|
|00000c30| 74 20 3d 3d 20 30 20 26 | 26 20 64 62 66 2d 3e 68 |t == 0 &|& dbf->h|
|00000c40| 65 61 64 65 72 2d 3e 61 | 76 61 69 6c 2e 6e 65 78 |eader->a|vail.nex|
|00000c50| 74 5f 62 6c 6f 63 6b 20 | 21 3d 20 30 29 0d 09 70 |t_block |!= 0)..p|
|00000c60| 6f 70 5f 61 76 61 69 6c | 5f 62 6c 6f 63 6b 20 28 |op_avail|_block (|
|00000c70| 64 62 66 29 3b 0d 20 20 | 20 20 20 20 0d 20 20 20 |dbf);. | . |
|00000c80| 20 20 20 2f 2a 20 47 65 | 74 20 61 6e 6f 74 68 65 | /* Ge|t anothe|
|00000c90| 72 20 66 75 6c 6c 20 62 | 6c 6f 63 6b 20 66 72 6f |r full b|lock fro|
|00000ca0| 6d 20 65 6e 64 20 6f 66 | 20 66 69 6c 65 2e 20 2a |m end of| file. *|
|00000cb0| 2f 0d 20 20 20 20 20 20 | 61 76 5f 65 6c 20 3d 20 |/. |av_el = |
|00000cc0| 67 65 74 5f 62 6c 6f 63 | 6b 20 28 6e 75 6d 5f 62 |get_bloc|k (num_b|
|00000cd0| 79 74 65 73 2c 20 64 62 | 66 29 3b 0d 0d 20 20 20 |ytes, db|f);.. |
|00000ce0| 20 20 20 64 62 66 2d 3e | 68 65 61 64 65 72 5f 63 | dbf->|header_c|
|00000cf0| 68 61 6e 67 65 64 20 3d | 20 54 52 55 45 3b 0d 20 |hanged =| TRUE;. |
|00000d00| 20 20 20 7d 0d 0d 20 20 | 2f 2a 20 57 65 20 6e 6f | }.. |/* We no|
|00000d10| 77 20 68 61 76 65 20 74 | 68 65 20 70 6c 61 63 65 |w have t|he place|
|00000d20| 20 66 72 6f 6d 20 77 68 | 69 63 68 20 77 65 20 77 | from wh|ich we w|
|00000d30| 69 6c 6c 20 61 6c 6c 6f | 63 61 74 65 20 74 68 65 |ill allo|cate the|
|00000d40| 20 6e 65 77 20 73 70 61 | 63 65 2e 20 2a 2f 0d 20 | new spa|ce. */. |
|00000d50| 20 66 69 6c 65 5f 61 64 | 72 20 3d 20 61 76 5f 65 | file_ad|r = av_e|
|00000d60| 6c 2e 61 76 5f 61 64 72 | 3b 0d 0d 20 20 2f 2a 20 |l.av_adr|;.. /* |
|00000d70| 50 75 74 20 74 68 65 20 | 75 6e 75 73 65 64 20 73 |Put the |unused s|
|00000d80| 70 61 63 65 20 62 61 63 | 6b 20 69 6e 20 74 68 65 |pace bac|k in the|
|00000d90| 20 61 76 61 69 6c 20 62 | 6c 6f 63 6b 2e 20 2a 2f | avail b|lock. */|
|00000da0| 0d 20 20 61 76 5f 65 6c | 2e 61 76 5f 61 64 72 20 |. av_el|.av_adr |
|00000db0| 2b 3d 20 6e 75 6d 5f 62 | 79 74 65 73 3b 0d 20 20 |+= num_b|ytes;. |
|00000dc0| 61 76 5f 65 6c 2e 61 76 | 5f 73 69 7a 65 20 2d 3d |av_el.av|_size -=|
|00000dd0| 20 6e 75 6d 5f 62 79 74 | 65 73 3b 0d 20 20 5f 67 | num_byt|es;. _g|
|00000de0| 64 62 6d 5f 66 72 65 65 | 20 28 64 62 66 2c 20 61 |dbm_free| (dbf, a|
|00000df0| 76 5f 65 6c 2e 61 76 5f | 61 64 72 2c 20 61 76 5f |v_el.av_|adr, av_|
|00000e00| 65 6c 2e 61 76 5f 73 69 | 7a 65 29 3b 0d 0d 20 20 |el.av_si|ze);.. |
|00000e10| 2f 2a 20 52 65 74 75 72 | 6e 20 74 68 65 20 61 64 |/* Retur|n the ad|
|00000e20| 64 72 65 73 73 2e 20 2a | 2f 0d 20 20 72 65 74 75 |dress. *|/. retu|
|00000e30| 72 6e 20 66 69 6c 65 5f | 61 64 72 3b 0d 20 20 0d |rn file_|adr;. .|
|00000e40| 7d 0d 0d 0d 0d 2f 2a 20 | 46 72 65 65 20 73 70 61 |}..../* |Free spa|
|00000e50| 63 65 20 6f 66 20 73 69 | 7a 65 20 4e 55 4d 5f 42 |ce of si|ze NUM_B|
|00000e60| 59 54 45 53 20 69 6e 20 | 74 68 65 20 66 69 6c 65 |YTES in |the file|
|00000e70| 20 44 42 46 20 61 74 20 | 66 69 6c 65 20 61 64 64 | DBF at |file add|
|00000e80| 72 65 73 73 20 46 49 4c | 45 5f 41 44 52 2e 20 20 |ress FIL|E_ADR. |
|00000e90| 4d 61 6b 65 0d 20 20 20 | 69 74 20 61 76 61 6c 69 |Make. |it avali|
|00000ea0| 61 62 6c 65 20 66 6f 72 | 20 72 65 75 73 65 20 74 |able for| reuse t|
|00000eb0| 68 72 6f 75 67 68 20 5f | 67 64 62 6d 5f 61 6c 6c |hrough _|gdbm_all|
|00000ec0| 6f 63 2e 20 20 54 68 69 | 73 20 72 6f 75 74 69 6e |oc. Thi|s routin|
|00000ed0| 65 20 63 68 61 6e 67 65 | 73 20 74 68 65 0d 20 20 |e change|s the. |
|00000ee0| 20 61 76 61 69 6c 20 73 | 74 72 75 63 74 75 72 65 | avail s|tructure|
|00000ef0| 2e 20 20 54 68 65 20 76 | 61 6c 75 65 20 54 52 55 |. The v|alue TRU|
|00000f00| 45 20 69 73 20 72 65 74 | 75 72 6e 65 64 20 69 66 |E is ret|urned if|
|00000f10| 20 74 68 65 72 65 20 77 | 65 72 65 20 65 72 72 6f | there w|ere erro|
|00000f20| 72 73 2e 20 20 49 66 20 | 6e 6f 0d 20 20 20 65 72 |rs. If |no. er|
|00000f30| 72 6f 72 73 20 6f 63 63 | 75 72 65 64 2c 20 74 68 |rors occ|ured, th|
|00000f40| 65 20 76 61 6c 75 65 20 | 46 41 4c 53 45 20 69 73 |e value |FALSE is|
|00000f50| 20 72 65 74 75 72 6e 65 | 64 2e 20 2a 2f 0d 0d 5f | returne|d. */.._|
|00000f60| 67 64 62 6d 5f 66 72 65 | 65 20 28 64 62 66 2c 20 |gdbm_fre|e (dbf, |
|00000f70| 66 69 6c 65 5f 61 64 72 | 2c 20 6e 75 6d 5f 62 79 |file_adr|, num_by|
|00000f80| 74 65 73 29 0d 20 20 20 | 20 20 67 64 62 6d 5f 66 |tes). | gdbm_f|
|00000f90| 69 6c 65 5f 69 6e 66 6f | 20 2a 64 62 66 3b 0d 20 |ile_info| *dbf;. |
|00000fa0| 20 20 20 20 6c 6f 6e 67 | 20 66 69 6c 65 5f 61 64 | long| file_ad|
|00000fb0| 72 3b 0d 20 20 20 20 20 | 69 6e 74 20 6e 75 6d 5f |r;. |int num_|
|00000fc0| 62 79 74 65 73 3b 0d 7b | 0d 20 20 61 76 61 69 6c |bytes;.{|. avail|
|00000fd0| 5f 65 6c 65 6d 20 74 65 | 6d 70 3b 0d 0d 20 20 2f |_elem te|mp;.. /|
|00000fe0| 2a 20 49 73 20 69 74 20 | 74 6f 6f 20 73 6d 61 6c |* Is it |too smal|
|00000ff0| 6c 20 74 6f 20 77 6f 72 | 72 79 20 61 62 6f 75 74 |l to wor|ry about|
|00001000| 3f 20 2a 2f 0d 20 20 69 | 66 20 28 6e 75 6d 5f 62 |? */. i|f (num_b|
|00001010| 79 74 65 73 20 3c 3d 20 | 49 47 4e 4f 52 45 5f 53 |ytes <= |IGNORE_S|
|00001020| 49 5a 45 29 0d 20 20 20 | 20 72 65 74 75 72 6e 3b |IZE). | return;|
|00001030| 0d 0d 20 20 2f 2a 20 49 | 6e 69 74 69 61 6c 69 7a |.. /* I|nitializ|
|00001040| 65 20 74 68 65 20 61 76 | 61 69 6c 20 65 6c 65 6d |e the av|ail elem|
|00001050| 65 6e 74 2e 20 2a 2f 0d | 20 20 74 65 6d 70 2e 61 |ent. */.| temp.a|
|00001060| 76 5f 73 69 7a 65 20 3d | 20 6e 75 6d 5f 62 79 74 |v_size =| num_byt|
|00001070| 65 73 3b 0d 20 20 74 65 | 6d 70 2e 61 76 5f 61 64 |es;. te|mp.av_ad|
|00001080| 72 20 3d 20 66 69 6c 65 | 5f 61 64 72 3b 0d 0d 20 |r = file|_adr;.. |
|00001090| 20 2f 2a 20 49 73 20 74 | 68 65 20 66 72 65 65 64 | /* Is t|he freed|
|000010a0| 20 73 70 61 63 65 20 6c | 61 72 67 65 20 6f 72 20 | space l|arge or |
|000010b0| 73 6d 61 6c 6c 3f 20 2a | 2f 0d 20 20 69 66 20 28 |small? *|/. if (|
|000010c0| 6e 75 6d 5f 62 79 74 65 | 73 20 3e 3d 20 64 62 66 |num_byte|s >= dbf|
|000010d0| 2d 3e 68 65 61 64 65 72 | 2d 3e 62 6c 6f 63 6b 5f |->header|->block_|
|000010e0| 73 69 7a 65 29 0d 20 20 | 20 20 7b 0d 20 20 20 20 |size). | {. |
|000010f0| 20 20 69 66 20 28 64 62 | 66 2d 3e 68 65 61 64 65 | if (db|f->heade|
|00001100| 72 2d 3e 61 76 61 69 6c | 2e 63 6f 75 6e 74 20 3d |r->avail|.count =|
|00001110| 3d 20 64 62 66 2d 3e 68 | 65 61 64 65 72 2d 3e 61 |= dbf->h|eader->a|
|00001120| 76 61 69 6c 2e 73 69 7a | 65 29 0d 09 7b 0d 09 20 |vail.siz|e)..{.. |
|00001130| 20 70 75 73 68 5f 61 76 | 61 69 6c 5f 62 6c 6f 63 | push_av|ail_bloc|
|00001140| 6b 20 28 64 62 66 29 3b | 0d 09 7d 0d 20 20 20 20 |k (dbf);|..}. |
|00001150| 20 20 5f 67 64 62 6d 5f | 70 75 74 5f 61 76 5f 65 | _gdbm_|put_av_e|
|00001160| 6c 65 6d 20 28 74 65 6d | 70 2c 20 64 62 66 2d 3e |lem (tem|p, dbf->|
|00001170| 68 65 61 64 65 72 2d 3e | 61 76 61 69 6c 2e 61 76 |header->|avail.av|
|00001180| 5f 74 61 62 6c 65 2c 0d | 09 09 09 20 26 64 62 66 |_table,.|... &dbf|
|00001190| 2d 3e 68 65 61 64 65 72 | 2d 3e 61 76 61 69 6c 2e |->header|->avail.|
|000011a0| 63 6f 75 6e 74 29 3b 0d | 20 20 20 20 20 20 64 62 |count);.| db|
|000011b0| 66 2d 3e 68 65 61 64 65 | 72 5f 63 68 61 6e 67 65 |f->heade|r_change|
|000011c0| 64 20 3d 20 54 52 55 45 | 3b 0d 20 20 20 20 7d 0d |d = TRUE|;. }.|
|000011d0| 20 20 65 6c 73 65 0d 20 | 20 20 20 7b 0d 20 20 20 | else. | {. |
|000011e0| 20 20 20 2f 2a 20 54 72 | 79 20 74 6f 20 70 75 74 | /* Tr|y to put|
|000011f0| 20 69 6e 74 6f 20 74 68 | 65 20 63 75 72 72 65 6e | into th|e curren|
|00001200| 74 20 62 75 63 6b 65 74 | 2e 20 2a 2f 0d 20 20 20 |t bucket|. */. |
|00001210| 20 20 20 69 66 20 28 64 | 62 66 2d 3e 62 75 63 6b | if (d|bf->buck|
|00001220| 65 74 2d 3e 61 76 5f 63 | 6f 75 6e 74 20 3c 20 42 |et->av_c|ount < B|
|00001230| 55 43 4b 45 54 5f 41 56 | 41 49 4c 29 0d 09 5f 67 |UCKET_AV|AIL).._g|
|00001240| 64 62 6d 5f 70 75 74 5f | 61 76 5f 65 6c 65 6d 20 |dbm_put_|av_elem |
|00001250| 28 74 65 6d 70 2c 20 64 | 62 66 2d 3e 62 75 63 6b |(temp, d|bf->buck|
|00001260| 65 74 2d 3e 62 75 63 6b | 65 74 5f 61 76 61 69 6c |et->buck|et_avail|
|00001270| 2c 0d 09 09 09 20 20 20 | 26 64 62 66 2d 3e 62 75 |,.... |&dbf->bu|
|00001280| 63 6b 65 74 2d 3e 61 76 | 5f 63 6f 75 6e 74 29 3b |cket->av|_count);|
|00001290| 0d 20 20 20 20 20 20 65 | 6c 73 65 0d 09 7b 0d 09 |. e|lse..{..|
|000012a0| 20 20 69 66 20 28 64 62 | 66 2d 3e 68 65 61 64 65 | if (db|f->heade|
|000012b0| 72 2d 3e 61 76 61 69 6c | 2e 63 6f 75 6e 74 20 3d |r->avail|.count =|
|000012c0| 3d 20 64 62 66 2d 3e 68 | 65 61 64 65 72 2d 3e 61 |= dbf->h|eader->a|
|000012d0| 76 61 69 6c 2e 73 69 7a | 65 29 0d 09 20 20 20 20 |vail.siz|e).. |
|000012e0| 7b 0d 09 20 20 20 20 20 | 20 70 75 73 68 5f 61 76 |{.. | push_av|
|000012f0| 61 69 6c 5f 62 6c 6f 63 | 6b 20 28 64 62 66 29 3b |ail_bloc|k (dbf);|
|00001300| 0d 09 20 20 20 20 7d 0d | 09 20 20 5f 67 64 62 6d |.. }.|. _gdbm|
|00001310| 5f 70 75 74 5f 61 76 5f | 65 6c 65 6d 20 28 74 65 |_put_av_|elem (te|
|00001320| 6d 70 2c 20 64 62 66 2d | 3e 68 65 61 64 65 72 2d |mp, dbf-|>header-|
|00001330| 3e 61 76 61 69 6c 2e 61 | 76 5f 74 61 62 6c 65 2c |>avail.a|v_table,|
|00001340| 0d 09 09 09 20 20 20 20 | 20 26 64 62 66 2d 3e 68 |.... | &dbf->h|
|00001350| 65 61 64 65 72 2d 3e 61 | 76 61 69 6c 2e 63 6f 75 |eader->a|vail.cou|
|00001360| 6e 74 29 3b 0d 09 20 20 | 64 62 66 2d 3e 68 65 61 |nt);.. |dbf->hea|
|00001370| 64 65 72 5f 63 68 61 6e | 67 65 64 20 3d 20 54 52 |der_chan|ged = TR|
|00001380| 55 45 3b 0d 09 7d 0d 20 | 20 20 20 7d 0d 0d 20 20 |UE;..}. | }.. |
|00001390| 69 66 20 28 64 62 66 2d | 3e 68 65 61 64 65 72 5f |if (dbf-|>header_|
|000013a0| 63 68 61 6e 67 65 64 29 | 0d 20 20 20 20 61 64 6a |changed)|. adj|
|000013b0| 75 73 74 5f 62 75 63 6b | 65 74 5f 61 76 61 69 6c |ust_buck|et_avail|
|000013c0| 20 28 64 62 66 29 3b 0d | 0d 20 20 2f 2a 20 41 6c | (dbf);.|. /* Al|
|000013d0| 6c 20 77 6f 72 6b 20 69 | 73 20 64 6f 6e 65 2e 20 |l work i|s done. |
|000013e0| 2a 2f 0d 20 20 72 65 74 | 75 72 6e 3b 0d 7d 0d 0d |*/. ret|urn;.}..|
|000013f0| 0d 0d 2f 2a 20 54 68 65 | 20 66 6f 6c 6c 6f 77 69 |../* The| followi|
|00001400| 6e 67 20 61 72 65 20 61 | 6c 6c 20 75 74 69 6c 69 |ng are a|ll utili|
|00001410| 74 79 20 72 6f 75 74 69 | 6e 65 73 20 6e 65 65 64 |ty routi|nes need|
|00001420| 65 64 20 62 79 20 74 68 | 65 20 70 72 65 76 69 6f |ed by th|e previo|
|00001430| 75 73 20 74 77 6f 2e 20 | 2a 2f 0d 0d 0d 2f 2a 20 |us two. |*/.../* |
|00001440| 47 65 74 73 20 74 68 65 | 20 61 76 61 69 6c 20 62 |Gets the| avail b|
|00001450| 6c 6f 63 6b 20 61 74 20 | 74 68 65 20 74 6f 70 20 |lock at |the top |
|00001460| 6f 66 20 74 68 65 20 73 | 74 61 63 6b 20 61 6e 64 |of the s|tack and|
|00001470| 20 6c 6f 61 64 73 20 69 | 74 20 69 6e 74 6f 20 74 | loads i|t into t|
|00001480| 68 65 0d 20 20 20 61 63 | 74 69 76 65 20 61 76 61 |he. ac|tive ava|
|00001490| 69 6c 20 62 6c 6f 63 6b | 2e 20 20 49 74 20 64 6f |il block|. It do|
|000014a0| 65 73 20 61 20 22 66 72 | 65 65 22 20 66 6f 72 20 |es a "fr|ee" for |
|000014b0| 69 74 73 65 6c 66 21 20 | 2a 2f 0d 0d 73 74 61 74 |itself! |*/..stat|
|000014c0| 69 63 0d 70 6f 70 5f 61 | 76 61 69 6c 5f 62 6c 6f |ic.pop_a|vail_blo|
|000014d0| 63 6b 20 28 64 62 66 29 | 0d 20 20 20 20 20 67 64 |ck (dbf)|. gd|
|000014e0| 62 6d 5f 66 69 6c 65 5f | 69 6e 66 6f 20 2a 64 62 |bm_file_|info *db|
|000014f0| 66 3b 0d 7b 0d 20 20 69 | 6e 74 20 20 6e 75 6d 5f |f;.{. i|nt num_|
|00001500| 62 79 74 65 73 3b 09 09 | 2f 2a 20 46 6f 72 20 75 |bytes;..|/* For u|
|00001510| 73 65 20 77 69 74 68 20 | 74 68 65 20 72 65 61 64 |se with |the read|
|00001520| 20 73 79 73 74 65 6d 20 | 63 61 6c 6c 2e 20 2a 2f | system |call. */|
|00001530| 0d 20 20 6c 6f 6e 67 20 | 66 69 6c 65 5f 70 6f 73 |. long |file_pos|
|00001540| 3b 09 09 2f 2a 20 46 6f | 72 20 75 73 65 20 77 69 |;../* Fo|r use wi|
|00001550| 74 68 20 74 68 65 20 6c | 73 65 65 6b 20 73 79 73 |th the l|seek sys|
|00001560| 74 65 6d 20 63 61 6c 6c | 2e 20 2a 2f 0d 20 20 61 |tem call|. */. a|
|00001570| 76 61 69 6c 5f 65 6c 65 | 6d 20 74 65 6d 70 3b 0d |vail_ele|m temp;.|
|00001580| 0d 20 20 2f 2a 20 53 65 | 74 20 75 70 20 76 61 72 |. /* Se|t up var|
|00001590| 69 61 62 6c 65 73 2e 20 | 2a 2f 0d 20 20 74 65 6d |iables. |*/. tem|
|000015a0| 70 2e 61 76 5f 61 64 72 | 20 3d 20 64 62 66 2d 3e |p.av_adr| = dbf->|
|000015b0| 68 65 61 64 65 72 2d 3e | 61 76 61 69 6c 2e 6e 65 |header->|avail.ne|
|000015c0| 78 74 5f 62 6c 6f 63 6b | 3b 0d 20 20 74 65 6d 70 |xt_block|;. temp|
|000015d0| 2e 61 76 5f 73 69 7a 65 | 20 3d 20 28 20 28 20 28 |.av_size| = ( ( (|
|000015e0| 64 62 66 2d 3e 68 65 61 | 64 65 72 2d 3e 61 76 61 |dbf->hea|der->ava|
|000015f0| 69 6c 2e 73 69 7a 65 20 | 2a 20 73 69 7a 65 6f 66 |il.size |* sizeof|
|00001600| 20 28 61 76 61 69 6c 5f | 65 6c 65 6d 29 29 20 3e | (avail_|elem)) >|
|00001610| 3e 20 31 29 0d 09 09 20 | 20 2b 20 73 69 7a 65 6f |> 1)... | + sizeo|
|00001620| 66 20 28 61 76 61 69 6c | 5f 62 6c 6f 63 6b 29 29 |f (avail|_block))|
|00001630| 3b 0d 0d 20 20 2f 2a 20 | 52 65 61 64 20 74 68 65 |;.. /* |Read the|
|00001640| 20 62 6c 6f 63 6b 2e 20 | 2a 2f 0d 20 20 66 69 6c | block. |*/. fil|
|00001650| 65 5f 70 6f 73 20 3d 20 | 6c 73 65 65 6b 20 28 64 |e_pos = |lseek (d|
|00001660| 62 66 2d 3e 64 65 73 63 | 2c 20 74 65 6d 70 2e 61 |bf->desc|, temp.a|
|00001670| 76 5f 61 64 72 2c 20 4c | 5f 53 45 54 29 3b 0d 20 |v_adr, L|_SET);. |
|00001680| 20 69 66 20 28 66 69 6c | 65 5f 70 6f 73 20 21 3d | if (fil|e_pos !=|
|00001690| 20 74 65 6d 70 2e 61 76 | 5f 61 64 72 29 20 20 5f | temp.av|_adr) _|
|000016a0| 67 64 62 6d 5f 66 61 74 | 61 6c 20 28 64 62 66 2c |gdbm_fat|al (dbf,|
|000016b0| 20 22 6c 73 65 65 6b 20 | 65 72 72 6f 72 22 29 3b | "lseek |error");|
|000016c0| 0d 20 20 6e 75 6d 5f 62 | 79 74 65 73 20 3d 20 72 |. num_b|ytes = r|
|000016d0| 65 61 64 20 28 64 62 66 | 2d 3e 64 65 73 63 2c 20 |ead (dbf|->desc, |
|000016e0| 28 63 68 61 72 20 2a 29 | 20 26 64 62 66 2d 3e 68 |(char *)| &dbf->h|
|000016f0| 65 61 64 65 72 2d 3e 61 | 76 61 69 6c 2c 20 74 65 |eader->a|vail, te|
|00001700| 6d 70 2e 61 76 5f 73 69 | 7a 65 29 3b 0d 20 20 69 |mp.av_si|ze);. i|
|00001710| 66 20 28 6e 75 6d 5f 62 | 79 74 65 73 20 21 3d 20 |f (num_b|ytes != |
|00001720| 74 65 6d 70 2e 61 76 5f | 73 69 7a 65 29 20 5f 67 |temp.av_|size) _g|
|00001730| 64 62 6d 5f 66 61 74 61 | 6c 20 28 64 62 66 2c 20 |dbm_fata|l (dbf, |
|00001740| 22 72 65 61 64 20 65 72 | 72 6f 72 22 29 3b 0d 0d |"read er|ror");..|
|00001750| 20 20 2f 2a 20 57 65 20 | 63 68 61 6e 67 65 64 20 | /* We |changed |
|00001760| 74 68 65 20 68 65 61 64 | 65 72 2e 20 2a 2f 0d 20 |the head|er. */. |
|00001770| 20 64 62 66 2d 3e 68 65 | 61 64 65 72 5f 63 68 61 | dbf->he|ader_cha|
|00001780| 6e 67 65 64 20 3d 20 54 | 52 55 45 3b 0d 0d 20 20 |nged = T|RUE;.. |
|00001790| 2f 2a 20 46 72 65 65 20 | 74 68 65 20 70 72 65 76 |/* Free |the prev|
|000017a0| 69 6f 75 73 20 61 76 61 | 69 6c 20 62 6c 6f 63 6b |ious ava|il block|
|000017b0| 2e 20 2a 2f 0d 20 20 5f | 67 64 62 6d 5f 70 75 74 |. */. _|gdbm_put|
|000017c0| 5f 61 76 5f 65 6c 65 6d | 20 28 74 65 6d 70 2c 20 |_av_elem| (temp, |
|000017d0| 64 62 66 2d 3e 68 65 61 | 64 65 72 2d 3e 61 76 61 |dbf->hea|der->ava|
|000017e0| 69 6c 2e 61 76 5f 74 61 | 62 6c 65 2c 0d 09 09 20 |il.av_ta|ble,... |
|000017f0| 20 20 20 20 26 64 62 66 | 2d 3e 68 65 61 64 65 72 | &dbf|->header|
|00001800| 2d 3e 61 76 61 69 6c 2e | 63 6f 75 6e 74 29 3b 0d |->avail.|count);.|
|00001810| 7d 0d 0d 0d 2f 2a 20 53 | 70 6c 69 74 73 20 74 68 |}.../* S|plits th|
|00001820| 65 20 68 65 61 64 65 72 | 20 61 76 61 69 6c 20 62 |e header| avail b|
|00001830| 6c 6f 63 6b 20 61 6e 64 | 20 70 75 73 68 65 73 20 |lock and| pushes |
|00001840| 68 61 6c 66 20 6f 6e 74 | 6f 20 74 68 65 20 61 76 |half ont|o the av|
|00001850| 61 69 6c 20 73 74 61 63 | 6b 2e 20 2a 2f 0d 0d 73 |ail stac|k. */..s|
|00001860| 74 61 74 69 63 0d 70 75 | 73 68 5f 61 76 61 69 6c |tatic.pu|sh_avail|
|00001870| 5f 62 6c 6f 63 6b 20 28 | 64 62 66 29 0d 20 20 20 |_block (|dbf). |
|00001880| 20 20 67 64 62 6d 5f 66 | 69 6c 65 5f 69 6e 66 6f | gdbm_f|ile_info|
|00001890| 20 2a 64 62 66 3b 0d 7b | 0d 20 20 69 6e 74 20 20 | *dbf;.{|. int |
|000018a0| 6e 75 6d 5f 62 79 74 65 | 73 3b 0d 20 20 69 6e 74 |num_byte|s;. int|
|000018b0| 20 20 61 76 5f 73 69 7a | 65 3b 0d 20 20 69 6e 74 | av_siz|e;. int|
|000018c0| 20 20 61 76 5f 61 64 72 | 3b 0d 20 20 69 6e 74 20 | av_adr|;. int |
|000018d0| 20 69 6e 64 65 78 3b 0d | 20 20 6c 6f 6e 67 20 66 | index;.| long f|
|000018e0| 69 6c 65 5f 70 6f 73 3b | 0d 20 20 61 76 61 69 6c |ile_pos;|. avail|
|000018f0| 5f 62 6c 6f 63 6b 20 2a | 74 65 6d 70 3b 0d 20 20 |_block *|temp;. |
|00001900| 61 76 61 69 6c 5f 65 6c | 65 6d 20 20 6e 65 77 5f |avail_el|em new_|
|00001910| 6c 6f 63 3b 0d 20 0d 0d | 20 20 2f 2a 20 43 61 63 |loc;. ..| /* Cac|
|00001920| 6c 75 6c 61 74 65 20 74 | 68 65 20 73 69 7a 65 20 |lulate t|he size |
|00001930| 6f 66 20 74 68 65 20 73 | 70 6c 69 74 20 62 6c 6f |of the s|plit blo|
|00001940| 63 6b 2e 20 2a 2f 0d 20 | 20 61 76 5f 73 69 7a 65 |ck. */. | av_size|
|00001950| 20 3d 20 28 20 28 64 62 | 66 2d 3e 68 65 61 64 65 | = ( (db|f->heade|
|00001960| 72 2d 3e 61 76 61 69 6c | 2e 73 69 7a 65 20 2a 20 |r->avail|.size * |
|00001970| 73 69 7a 65 6f 66 20 28 | 61 76 61 69 6c 5f 65 6c |sizeof (|avail_el|
|00001980| 65 6d 29 29 20 3e 3e 20 | 31 29 0d 20 20 20 20 20 |em)) >> |1). |
|00001990| 20 20 20 20 20 20 20 2b | 20 73 69 7a 65 6f 66 20 | +| sizeof |
|000019a0| 28 61 76 61 69 6c 5f 62 | 6c 6f 63 6b 29 3b 0d 0d |(avail_b|lock);..|
|000019b0| 20 20 2f 2a 20 47 65 74 | 20 61 64 64 72 65 73 73 | /* Get| address|
|000019c0| 20 69 6e 20 66 69 6c 65 | 20 66 6f 72 20 6e 65 77 | in file| for new|
|000019d0| 20 61 76 5f 73 69 7a 65 | 20 62 79 74 65 73 2e 20 | av_size| bytes. |
|000019e0| 2a 2f 0d 20 20 6e 65 77 | 5f 6c 6f 63 20 3d 20 67 |*/. new|_loc = g|
|000019f0| 65 74 5f 65 6c 65 6d 20 | 28 61 76 5f 73 69 7a 65 |et_elem |(av_size|
|00001a00| 2c 20 64 62 66 2d 3e 68 | 65 61 64 65 72 2d 3e 61 |, dbf->h|eader->a|
|00001a10| 76 61 69 6c 2e 61 76 5f | 74 61 62 6c 65 2c 0d 09 |vail.av_|table,..|
|00001a20| 09 20 20 20 20 20 20 26 | 64 62 66 2d 3e 68 65 61 |. &|dbf->hea|
|00001a30| 64 65 72 2d 3e 61 76 61 | 69 6c 2e 63 6f 75 6e 74 |der->ava|il.count|
|00001a40| 29 3b 0d 20 20 69 66 20 | 28 6e 65 77 5f 6c 6f 63 |);. if |(new_loc|
|00001a50| 2e 61 76 5f 73 69 7a 65 | 20 3d 3d 20 30 29 0d 20 |.av_size| == 0). |
|00001a60| 20 20 20 6e 65 77 5f 6c | 6f 63 20 3d 20 67 65 74 | new_l|oc = get|
|00001a70| 5f 62 6c 6f 63 6b 20 28 | 61 76 5f 73 69 7a 65 2c |_block (|av_size,|
|00001a80| 20 64 62 66 29 3b 0d 20 | 20 61 76 5f 61 64 72 20 | dbf);. | av_adr |
|00001a90| 3d 20 6e 65 77 5f 6c 6f | 63 2e 61 76 5f 61 64 72 |= new_lo|c.av_adr|
|00001aa0| 3b 0d 0d 0d 20 20 2f 2a | 20 53 70 6c 69 74 20 74 |;... /*| Split t|
|00001ab0| 68 65 20 68 65 61 64 65 | 72 20 62 6c 6f 63 6b 2e |he heade|r block.|
|00001ac0| 20 2a 2f 0d 20 20 74 65 | 6d 70 20 3d 20 28 61 76 | */. te|mp = (av|
|00001ad0| 61 69 6c 5f 62 6c 6f 63 | 6b 20 2a 29 20 61 6c 6c |ail_bloc|k *) all|
|00001ae0| 6f 63 61 20 28 61 76 5f | 73 69 7a 65 29 3b 0d 20 |oca (av_|size);. |
|00001af0| 20 2f 2a 20 53 65 74 20 | 74 68 65 20 73 69 7a 65 | /* Set |the size|
|00001b00| 20 74 6f 20 62 65 20 63 | 6f 72 72 65 63 74 20 41 | to be c|orrect A|
|00001b10| 46 54 45 52 20 74 68 65 | 20 70 6f 70 5f 61 76 61 |FTER the| pop_ava|
|00001b20| 69 6c 5f 62 6c 6f 63 6b | 2e 20 2a 2f 0d 20 20 74 |il_block|. */. t|
|00001b30| 65 6d 70 2d 3e 73 69 7a | 65 20 3d 20 64 62 66 2d |emp->siz|e = dbf-|
|00001b40| 3e 68 65 61 64 65 72 2d | 3e 61 76 61 69 6c 2e 73 |>header-|>avail.s|
|00001b50| 69 7a 65 3b 0d 20 20 74 | 65 6d 70 2d 3e 63 6f 75 |ize;. t|emp->cou|
|00001b60| 6e 74 20 3d 20 30 3b 0d | 20 20 74 65 6d 70 2d 3e |nt = 0;.| temp->|
|00001b70| 6e 65 78 74 5f 62 6c 6f | 63 6b 20 3d 20 64 62 66 |next_blo|ck = dbf|
|00001b80| 2d 3e 68 65 61 64 65 72 | 2d 3e 61 76 61 69 6c 2e |->header|->avail.|
|00001b90| 6e 65 78 74 5f 62 6c 6f | 63 6b 3b 0d 20 20 64 62 |next_blo|ck;. db|
|00001ba0| 66 2d 3e 68 65 61 64 65 | 72 2d 3e 61 76 61 69 6c |f->heade|r->avail|
|00001bb0| 2e 6e 65 78 74 5f 62 6c | 6f 63 6b 20 3d 20 61 76 |.next_bl|ock = av|
|00001bc0| 5f 61 64 72 3b 0d 20 20 | 66 6f 72 20 28 69 6e 64 |_adr;. |for (ind|
|00001bd0| 65 78 20 3d 20 31 3b 20 | 69 6e 64 65 78 20 3c 20 |ex = 1; |index < |
|00001be0| 64 62 66 2d 3e 68 65 61 | 64 65 72 2d 3e 61 76 61 |dbf->hea|der->ava|
|00001bf0| 69 6c 2e 63 6f 75 6e 74 | 3b 20 69 6e 64 65 78 2b |il.count|; index+|
|00001c00| 2b 29 0d 20 20 20 20 69 | 66 20 28 20 28 69 6e 64 |+). i|f ( (ind|
|00001c10| 65 78 20 26 20 30 78 31 | 29 20 3d 3d 20 31 29 09 |ex & 0x1|) == 1).|
|00001c20| 2f 2a 20 49 6e 64 65 78 | 20 69 73 20 6f 64 64 2e |/* Index| is odd.|
|00001c30| 20 2a 2f 0d 20 20 20 20 | 20 20 74 65 6d 70 2d 3e | */. | temp->|
|00001c40| 61 76 5f 74 61 62 6c 65 | 5b 74 65 6d 70 2d 3e 63 |av_table|[temp->c|
|00001c50| 6f 75 6e 74 2b 2b 5d 20 | 3d 20 64 62 66 2d 3e 68 |ount++] |= dbf->h|
|00001c60| 65 61 64 65 72 2d 3e 61 | 76 61 69 6c 2e 61 76 5f |eader->a|vail.av_|
|00001c70| 74 61 62 6c 65 5b 69 6e | 64 65 78 5d 3b 0d 20 20 |table[in|dex];. |
|00001c80| 20 20 65 6c 73 65 0d 20 | 20 20 20 20 20 64 62 66 | else. | dbf|
|00001c90| 2d 3e 68 65 61 64 65 72 | 2d 3e 61 76 61 69 6c 2e |->header|->avail.|
|00001ca0| 61 76 5f 74 61 62 6c 65 | 5b 69 6e 64 65 78 3e 3e |av_table|[index>>|
|00001cb0| 31 5d 0d 09 3d 20 64 62 | 66 2d 3e 68 65 61 64 65 |1]..= db|f->heade|
|00001cc0| 72 2d 3e 61 76 61 69 6c | 2e 61 76 5f 74 61 62 6c |r->avail|.av_tabl|
|00001cd0| 65 5b 69 6e 64 65 78 5d | 3b 0d 0d 20 20 2f 2a 20 |e[index]|;.. /* |
|00001ce0| 55 70 64 61 74 65 20 74 | 68 65 20 68 65 61 64 65 |Update t|he heade|
|00001cf0| 72 20 61 76 61 69 6c 20 | 63 6f 75 6e 74 20 74 6f |r avail |count to|
|00001d00| 20 70 72 65 76 69 6f 75 | 73 20 73 69 7a 65 20 64 | previou|s size d|
|00001d10| 69 76 69 64 65 64 20 62 | 79 20 32 2e 20 2a 2f 0d |ivided b|y 2. */.|
|00001d20| 20 20 64 62 66 2d 3e 68 | 65 61 64 65 72 2d 3e 61 | dbf->h|eader->a|
|00001d30| 76 61 69 6c 2e 63 6f 75 | 6e 74 20 3e 3e 3d 20 31 |vail.cou|nt >>= 1|
|00001d40| 3b 0d 0d 20 20 2f 2a 20 | 46 72 65 65 20 74 68 65 |;.. /* |Free the|
|00001d50| 20 75 6e 6e 65 65 64 65 | 64 20 73 70 61 63 65 2e | unneede|d space.|
|00001d60| 20 2a 2f 0d 20 20 6e 65 | 77 5f 6c 6f 63 2e 61 76 | */. ne|w_loc.av|
|00001d70| 5f 61 64 72 20 2b 3d 20 | 61 76 5f 73 69 7a 65 3b |_adr += |av_size;|
|00001d80| 0d 20 20 6e 65 77 5f 6c | 6f 63 2e 61 76 5f 73 69 |. new_l|oc.av_si|
|00001d90| 7a 65 20 2d 3d 20 61 76 | 5f 73 69 7a 65 3b 0d 20 |ze -= av|_size;. |
|00001da0| 20 5f 67 64 62 6d 5f 66 | 72 65 65 20 28 64 62 66 | _gdbm_f|ree (dbf|
|00001db0| 2c 20 6e 65 77 5f 6c 6f | 63 2e 61 76 5f 61 64 72 |, new_lo|c.av_adr|
|00001dc0| 2c 20 6e 65 77 5f 6c 6f | 63 2e 61 76 5f 73 69 7a |, new_lo|c.av_siz|
|00001dd0| 65 29 3b 0d 0d 20 20 2f | 2a 20 55 70 64 61 74 65 |e);.. /|* Update|
|00001de0| 20 74 68 65 20 64 69 73 | 6b 2e 20 2a 2f 0d 20 20 | the dis|k. */. |
|00001df0| 66 69 6c 65 5f 70 6f 73 | 20 3d 20 6c 73 65 65 6b |file_pos| = lseek|
|00001e00| 20 28 64 62 66 2d 3e 64 | 65 73 63 2c 20 61 76 5f | (dbf->d|esc, av_|
|00001e10| 61 64 72 2c 20 4c 5f 53 | 45 54 29 3b 0d 20 20 69 |adr, L_S|ET);. i|
|00001e20| 66 20 28 66 69 6c 65 5f | 70 6f 73 20 21 3d 20 61 |f (file_|pos != a|
|00001e30| 76 5f 61 64 72 29 20 5f | 67 64 62 6d 5f 66 61 74 |v_adr) _|gdbm_fat|
|00001e40| 61 6c 20 28 64 62 66 2c | 20 22 6c 73 65 65 6b 20 |al (dbf,| "lseek |
|00001e50| 65 72 72 6f 72 22 29 3b | 0d 20 20 6e 75 6d 5f 62 |error");|. num_b|
|00001e60| 79 74 65 73 20 3d 20 77 | 72 69 74 65 20 28 64 62 |ytes = w|rite (db|
|00001e70| 66 2d 3e 64 65 73 63 2c | 20 28 63 68 61 72 20 2a |f->desc,| (char *|
|00001e80| 29 20 74 65 6d 70 2c 20 | 61 76 5f 73 69 7a 65 29 |) temp, |av_size)|
|00001e90| 3b 0d 20 20 69 66 20 28 | 6e 75 6d 5f 62 79 74 65 |;. if (|num_byte|
|00001ea0| 73 20 21 3d 20 61 76 5f | 73 69 7a 65 29 20 5f 67 |s != av_|size) _g|
|00001eb0| 64 62 6d 5f 66 61 74 61 | 6c 20 28 64 62 66 2c 20 |dbm_fata|l (dbf, |
|00001ec0| 22 77 72 69 74 65 20 65 | 72 72 6f 72 22 29 3b 0d |"write e|rror");.|
|00001ed0| 0d 7d 0d 0d 0d 0d 2f 2a | 20 47 65 74 5f 65 6c 65 |.}..../*| Get_ele|
|00001ee0| 6d 20 72 65 74 75 72 6e | 73 20 61 6e 20 65 6c 65 |m return|s an ele|
|00001ef0| 6d 65 6e 74 20 69 6e 20 | 74 68 65 20 41 56 5f 54 |ment in |the AV_T|
|00001f00| 41 42 4c 45 20 62 6c 6f | 63 6b 20 77 68 69 63 68 |ABLE blo|ck which|
|00001f10| 20 69 73 0d 20 20 20 6c | 61 72 67 65 72 20 74 68 | is. l|arger th|
|00001f20| 61 6e 20 53 49 5a 45 2e | 20 20 41 56 5f 43 4f 55 |an SIZE.| AV_COU|
|00001f30| 4e 54 20 69 73 20 74 68 | 65 20 6e 75 6d 62 65 72 |NT is th|e number|
|00001f40| 20 6f 66 20 65 6c 65 6d | 65 6e 74 73 20 69 6e 20 | of elem|ents in |
|00001f50| 74 68 65 0d 20 20 20 41 | 56 5f 54 41 42 4c 45 2e |the. A|V_TABLE.|
|00001f60| 20 20 49 66 20 61 6e 20 | 69 74 65 6d 20 69 73 20 | If an |item is |
|00001f70| 66 6f 75 6e 64 2c 20 69 | 74 20 65 78 74 72 61 63 |found, i|t extrac|
|00001f80| 74 73 20 69 74 20 66 72 | 6f 6d 20 74 68 65 20 41 |ts it fr|om the A|
|00001f90| 56 5f 54 41 42 4c 45 0d | 20 20 20 61 6e 64 20 6d |V_TABLE.| and m|
|00001fa0| 6f 76 65 73 20 74 68 65 | 20 6f 74 68 65 72 20 65 |oves the| other e|
|00001fb0| 6c 65 6d 65 6e 74 73 20 | 75 70 20 74 6f 20 66 69 |lements |up to fi|
|00001fc0| 6c 6c 20 74 68 65 20 73 | 70 61 63 65 2e 20 49 66 |ll the s|pace. If|
|00001fd0| 20 6e 6f 20 62 6c 6f 63 | 6b 20 69 73 20 0d 20 20 | no bloc|k is . |
|00001fe0| 20 66 6f 75 6e 64 20 6c | 61 72 67 65 72 20 74 68 | found l|arger th|
|00001ff0| 61 6e 20 53 49 5a 45 2c | 20 67 65 74 5f 65 6c 65 |an SIZE,| get_ele|
|00002000| 6d 20 72 65 74 75 72 6e | 73 20 61 20 73 69 7a 65 |m return|s a size|
|00002010| 20 6f 66 20 7a 65 72 6f | 2e 20 20 54 68 69 73 0d | of zero|. This.|
|00002020| 20 20 20 72 6f 75 74 69 | 6e 65 20 64 6f 65 73 20 | routi|ne does |
|00002030| 6e 6f 20 49 2f 4f 2e 20 | 2a 2f 0d 0d 73 74 61 74 |no I/O. |*/..stat|
|00002040| 69 63 20 61 76 61 69 6c | 5f 65 6c 65 6d 0d 67 65 |ic avail|_elem.ge|
|00002050| 74 5f 65 6c 65 6d 20 28 | 73 69 7a 65 2c 20 61 76 |t_elem (|size, av|
|00002060| 5f 74 61 62 6c 65 2c 20 | 61 76 5f 63 6f 75 6e 74 |_table, |av_count|
|00002070| 29 0d 20 20 20 20 20 69 | 6e 74 20 73 69 7a 65 3b |). i|nt size;|
|00002080| 0d 20 20 20 20 20 61 76 | 61 69 6c 5f 65 6c 65 6d |. av|ail_elem|
|00002090| 20 61 76 5f 74 61 62 6c | 65 5b 5d 3b 0d 20 20 20 | av_tabl|e[];. |
|000020a0| 20 20 69 6e 74 20 2a 61 | 76 5f 63 6f 75 6e 74 3b | int *a|v_count;|
|000020b0| 0d 7b 0d 20 20 69 6e 74 | 20 69 6e 64 65 78 3b 09 |.{. int| index;.|
|000020c0| 09 09 2f 2a 20 46 6f 72 | 20 73 65 61 72 63 68 69 |../* For| searchi|
|000020d0| 6e 67 20 74 68 72 6f 75 | 67 68 20 74 68 65 20 61 |ng throu|gh the a|
|000020e0| 76 61 69 6c 20 62 6c 6f | 63 6b 2e 20 2a 2f 0d 20 |vail blo|ck. */. |
|000020f0| 20 61 76 61 69 6c 5f 65 | 6c 65 6d 20 76 61 6c 3b | avail_e|lem val;|
|00002100| 09 09 2f 2a 20 54 68 65 | 20 64 65 66 61 75 6c 74 |../* The| default|
|00002110| 20 72 65 74 75 72 6e 20 | 76 61 6c 75 65 2e 20 2a | return |value. *|
|00002120| 2f 0d 0d 20 20 2f 2a 20 | 49 6e 69 74 69 61 6c 69 |/.. /* |Initiali|
|00002130| 7a 65 20 64 65 66 61 75 | 6c 74 20 72 65 74 75 72 |ze defau|lt retur|
|00002140| 6e 20 76 61 6c 75 65 2e | 20 2a 2f 0d 20 20 76 61 |n value.| */. va|
|00002150| 6c 2e 61 76 5f 61 64 72 | 20 3d 20 30 3b 0d 20 20 |l.av_adr| = 0;. |
|00002160| 76 61 6c 2e 61 76 5f 73 | 69 7a 65 20 3d 20 30 3b |val.av_s|ize = 0;|
|00002170| 0d 0d 20 20 2f 2a 20 53 | 65 61 72 63 68 20 66 6f |.. /* S|earch fo|
|00002180| 72 20 65 6c 65 6d 65 6e | 74 2e 20 20 4c 69 73 74 |r elemen|t. List|
|00002190| 20 69 73 20 73 6f 72 74 | 65 64 20 62 79 20 73 69 | is sort|ed by si|
|000021a0| 7a 65 2e 20 2a 2f 0d 20 | 20 69 6e 64 65 78 20 3d |ze. */. | index =|
|000021b0| 20 30 3b 0d 20 20 77 68 | 69 6c 65 20 28 69 6e 64 | 0;. wh|ile (ind|
|000021c0| 65 78 20 3c 20 2a 61 76 | 5f 63 6f 75 6e 74 20 26 |ex < *av|_count &|
|000021d0| 26 20 61 76 5f 74 61 62 | 6c 65 5b 69 6e 64 65 78 |& av_tab|le[index|
|000021e0| 5d 2e 61 76 5f 73 69 7a | 65 20 3c 20 73 69 7a 65 |].av_siz|e < size|
|000021f0| 29 0d 20 20 20 20 7b 0d | 20 20 20 20 20 20 69 6e |). {.| in|
|00002200| 64 65 78 2b 2b 3b 0d 20 | 20 20 20 7d 0d 0d 20 20 |dex++;. | }.. |
|00002210| 2f 2a 20 44 69 64 20 77 | 65 20 66 69 6e 64 20 6f |/* Did w|e find o|
|00002220| 6e 65 20 6f 66 20 74 68 | 65 20 72 69 67 68 74 20 |ne of th|e right |
|00002230| 73 69 7a 65 3f 20 2a 2f | 0d 20 20 69 66 20 28 69 |size? */|. if (i|
|00002240| 6e 64 65 78 20 3e 3d 20 | 2a 61 76 5f 63 6f 75 6e |ndex >= |*av_coun|
|00002250| 74 29 0d 20 20 20 20 72 | 65 74 75 72 6e 20 76 61 |t). r|eturn va|
|00002260| 6c 3b 0d 0d 20 20 2f 2a | 20 4f 6b 2c 20 73 61 76 |l;.. /*| Ok, sav|
|00002270| 65 20 74 68 61 74 20 65 | 6c 65 6d 65 6e 74 20 61 |e that e|lement a|
|00002280| 6e 64 20 6d 6f 76 65 20 | 61 6c 6c 20 6f 74 68 65 |nd move |all othe|
|00002290| 72 73 20 75 70 20 6f 6e | 65 2e 20 2a 2f 0d 20 20 |rs up on|e. */. |
|000022a0| 76 61 6c 20 3d 20 61 76 | 5f 74 61 62 6c 65 5b 69 |val = av|_table[i|
|000022b0| 6e 64 65 78 5d 3b 0d 20 | 20 2a 61 76 5f 63 6f 75 |ndex];. | *av_cou|
|000022c0| 6e 74 20 2d 3d 20 31 3b | 0d 20 20 77 68 69 6c 65 |nt -= 1;|. while|
|000022d0| 20 28 69 6e 64 65 78 20 | 3c 20 2a 61 76 5f 63 6f | (index |< *av_co|
|000022e0| 75 6e 74 29 0d 20 20 20 | 20 7b 0d 20 20 20 20 20 |unt). | {. |
|000022f0| 20 61 76 5f 74 61 62 6c | 65 5b 69 6e 64 65 78 5d | av_tabl|e[index]|
|00002300| 20 3d 20 61 76 5f 74 61 | 62 6c 65 5b 69 6e 64 65 | = av_ta|ble[inde|
|00002310| 78 2b 31 5d 3b 0d 20 20 | 20 20 20 20 69 6e 64 65 |x+1];. | inde|
|00002320| 78 2b 2b 3b 0d 20 20 20 | 20 7d 0d 0d 20 20 72 65 |x++;. | }.. re|
|00002330| 74 75 72 6e 20 76 61 6c | 3b 0d 7d 0d 0d 0d 2f 2a |turn val|;.}.../*|
|00002340| 20 54 68 69 73 20 72 6f | 75 74 69 6e 65 20 69 6e | This ro|utine in|
|00002350| 73 65 72 74 73 20 61 20 | 73 69 6e 67 6c 65 20 4e |serts a |single N|
|00002360| 45 57 5f 45 4c 20 69 6e | 74 6f 20 74 68 65 20 41 |EW_EL in|to the A|
|00002370| 56 5f 54 41 42 4c 45 20 | 62 6c 6f 63 6b 20 69 6e |V_TABLE |block in|
|00002380| 0d 20 20 20 73 6f 72 74 | 65 64 20 6f 72 64 65 72 |. sort|ed order|
|00002390| 2e 20 54 68 69 73 20 72 | 6f 75 74 69 6e 65 20 64 |. This r|outine d|
|000023a0| 6f 65 73 20 6e 6f 20 49 | 2f 4f 2e 20 2a 2f 0d 0d |oes no I|/O. */..|
|000023b0| 5f 67 64 62 6d 5f 70 75 | 74 5f 61 76 5f 65 6c 65 |_gdbm_pu|t_av_ele|
|000023c0| 6d 20 28 6e 65 77 5f 65 | 6c 2c 20 61 76 5f 74 61 |m (new_e|l, av_ta|
|000023d0| 62 6c 65 2c 20 61 76 5f | 63 6f 75 6e 74 29 0d 20 |ble, av_|count). |
|000023e0| 20 20 20 20 61 76 61 69 | 6c 5f 65 6c 65 6d 20 6e | avai|l_elem n|
|000023f0| 65 77 5f 65 6c 3b 0d 20 | 20 20 20 20 61 76 61 69 |ew_el;. | avai|
|00002400| 6c 5f 65 6c 65 6d 20 61 | 76 5f 74 61 62 6c 65 5b |l_elem a|v_table[|
|00002410| 5d 3b 0d 20 20 20 20 20 | 69 6e 74 20 2a 61 76 5f |];. |int *av_|
|00002420| 63 6f 75 6e 74 3b 0d 7b | 0d 20 20 69 6e 74 20 69 |count;.{|. int i|
|00002430| 6e 64 65 78 3b 09 09 09 | 2f 2a 20 46 6f 72 20 73 |ndex;...|/* For s|
|00002440| 65 61 72 63 68 69 6e 67 | 20 74 68 72 6f 75 67 68 |earching| through|
|00002450| 20 74 68 65 20 61 76 61 | 69 6c 20 62 6c 6f 63 6b | the ava|il block|
|00002460| 2e 20 2a 2f 0d 20 20 69 | 6e 74 20 69 6e 64 65 78 |. */. i|nt index|
|00002470| 31 3b 0d 0d 20 20 2f 2a | 20 49 73 20 69 74 20 74 |1;.. /*| Is it t|
|00002480| 6f 6f 20 73 6d 61 6c 6c | 20 74 6f 20 64 65 61 6c |oo small| to deal|
|00002490| 20 77 69 74 68 3f 20 2a | 2f 0d 20 20 69 66 20 28 | with? *|/. if (|
|000024a0| 6e 65 77 5f 65 6c 2e 61 | 76 5f 73 69 7a 65 20 3c |new_el.a|v_size <|
|000024b0| 3d 20 49 47 4e 4f 52 45 | 5f 53 49 5a 45 29 0d 20 |= IGNORE|_SIZE). |
|000024c0| 20 20 20 72 65 74 75 72 | 6e 20 46 41 4c 53 45 3b | retur|n FALSE;|
|000024d0| 20 0d 0d 20 20 2f 2a 20 | 53 65 61 72 63 68 20 66 | .. /* |Search f|
|000024e0| 6f 72 20 70 6c 61 63 65 | 20 74 6f 20 70 75 74 20 |or place| to put |
|000024f0| 65 6c 65 6d 65 6e 74 2e | 20 20 4c 69 73 74 20 69 |element.| List i|
|00002500| 73 20 73 6f 72 74 65 64 | 20 62 79 20 73 69 7a 65 |s sorted| by size|
|00002510| 2e 20 2a 2f 0d 20 20 69 | 6e 64 65 78 20 3d 20 30 |. */. i|ndex = 0|
|00002520| 3b 0d 20 20 77 68 69 6c | 65 20 28 69 6e 64 65 78 |;. whil|e (index|
|00002530| 20 3c 20 2a 61 76 5f 63 | 6f 75 6e 74 20 26 26 20 | < *av_c|ount && |
|00002540| 61 76 5f 74 61 62 6c 65 | 5b 69 6e 64 65 78 5d 2e |av_table|[index].|
|00002550| 61 76 5f 73 69 7a 65 20 | 3c 20 6e 65 77 5f 65 6c |av_size |< new_el|
|00002560| 2e 61 76 5f 73 69 7a 65 | 29 0d 20 20 20 20 7b 0d |.av_size|). {.|
|00002570| 20 20 20 20 20 20 69 6e | 64 65 78 2b 2b 3b 0d 20 | in|dex++;. |
|00002580| 20 20 20 7d 0d 0d 20 20 | 2f 2a 20 4d 6f 76 65 20 | }.. |/* Move |
|00002590| 61 6c 6c 20 6f 74 68 65 | 72 73 20 75 70 20 6f 6e |all othe|rs up on|
|000025a0| 65 2e 20 2a 2f 0d 20 20 | 69 6e 64 65 78 31 20 3d |e. */. |index1 =|
|000025b0| 20 2a 61 76 5f 63 6f 75 | 6e 74 2d 31 3b 0d 20 20 | *av_cou|nt-1;. |
|000025c0| 77 68 69 6c 65 20 28 69 | 6e 64 65 78 31 20 3e 3d |while (i|ndex1 >=|
|000025d0| 20 69 6e 64 65 78 29 0d | 20 20 20 20 7b 0d 20 20 | index).| {. |
|000025e0| 20 20 20 20 61 76 5f 74 | 61 62 6c 65 5b 69 6e 64 | av_t|able[ind|
|000025f0| 65 78 31 2b 31 5d 20 3d | 20 61 76 5f 74 61 62 6c |ex1+1] =| av_tabl|
|00002600| 65 5b 69 6e 64 65 78 31 | 5d 3b 0d 20 20 20 20 20 |e[index1|];. |
|00002610| 20 69 6e 64 65 78 31 2d | 2d 3b 0d 20 20 20 20 7d | index1-|-;. }|
|00002620| 0d 20 20 0d 20 20 2f 2a | 20 41 64 64 20 74 68 65 |. . /*| Add the|
|00002630| 20 6e 65 77 20 65 6c 65 | 6d 65 6e 74 2e 20 2a 2f | new ele|ment. */|
|00002640| 0d 20 20 61 76 5f 74 61 | 62 6c 65 5b 69 6e 64 65 |. av_ta|ble[inde|
|00002650| 78 5d 20 3d 20 6e 65 77 | 5f 65 6c 3b 0d 0d 20 20 |x] = new|_el;.. |
|00002660| 2f 2a 20 49 6e 63 72 65 | 6d 65 6e 74 20 74 68 65 |/* Incre|ment the|
|00002670| 20 6e 75 6d 62 65 72 20 | 6f 66 20 65 6c 65 6d 65 | number |of eleme|
|00002680| 6e 74 73 2e 20 2a 2f 0d | 20 20 2a 61 76 5f 63 6f |nts. */.| *av_co|
|00002690| 75 6e 74 20 2b 3d 20 31 | 3b 20 20 0d 0d 20 20 72 |unt += 1|; .. r|
|000026a0| 65 74 75 72 6e 20 54 52 | 55 45 3b 0d 7d 0d 0d 0d |eturn TR|UE;.}...|
|000026b0| 0d 2f 2a 20 47 65 74 5f | 62 6c 6f 63 6b 20 22 61 |./* Get_|block "a|
|000026c0| 6c 6c 6f 63 61 74 65 73 | 22 20 6e 65 77 20 66 69 |llocates|" new fi|
|000026d0| 6c 65 20 73 70 61 63 65 | 20 61 6e 64 20 74 68 65 |le space| and the|
|000026e0| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 66 69 6c 65 | end of |the file|
|000026f0| 2e 20 20 54 68 69 73 20 | 69 73 0d 20 20 20 64 6f |. This |is. do|
|00002700| 6e 65 20 69 6e 20 69 6e | 74 65 67 72 61 6c 20 62 |ne in in|tegral b|
|00002710| 6c 6f 63 6b 20 73 69 7a | 65 73 2e 20 20 28 54 68 |lock siz|es. (Th|
|00002720| 69 73 20 68 65 6c 70 73 | 20 69 6e 73 75 72 65 20 |is helps| insure |
|00002730| 74 68 61 74 20 64 61 74 | 61 20 73 6d 61 6c 6c 65 |that dat|a smalle|
|00002740| 72 20 74 68 61 6e 0d 20 | 20 20 6f 6e 65 20 62 6c |r than. | one bl|
|00002750| 6f 63 6b 20 73 69 7a 65 | 20 69 73 20 69 6e 20 61 |ock size| is in a|
|00002760| 20 73 69 6e 67 6c 65 20 | 62 6c 6f 63 6b 2e 29 20 | single |block.) |
|00002770| 20 45 6e 6f 75 67 68 20 | 62 6c 6f 63 6b 73 20 61 | Enough |blocks a|
|00002780| 72 65 20 61 6c 6c 6f 63 | 61 74 65 64 20 74 6f 0d |re alloc|ated to.|
|00002790| 20 20 20 6d 61 6b 65 20 | 73 75 72 65 20 74 68 65 | make |sure the|
|000027a0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 62 79 74 65 73 | number |of bytes|
|000027b0| 20 61 6c 6c 6f 63 61 74 | 65 64 20 69 6e 20 74 68 | allocat|ed in th|
|000027c0| 65 20 62 6c 6f 63 6b 73 | 20 69 73 20 6c 61 72 67 |e blocks| is larg|
|000027d0| 65 72 20 74 68 61 6e 20 | 53 49 5a 45 2e 0d 20 20 |er than |SIZE.. |
|000027e0| 20 44 42 46 20 63 6f 6e | 74 61 69 6e 73 20 74 68 | DBF con|tains th|
|000027f0| 65 20 66 69 6c 65 20 68 | 65 61 64 65 72 20 74 68 |e file h|eader th|
|00002800| 61 74 20 6e 65 65 64 73 | 20 75 70 64 61 74 69 6e |at needs| updatin|
|00002810| 67 2e 20 20 54 68 69 73 | 20 72 6f 75 74 69 6e 65 |g. This| routine|
|00002820| 20 64 6f 65 73 0d 20 20 | 20 6e 6f 20 49 2f 4f 2e | does. | no I/O.|
|00002830| 20 20 2a 2f 0d 0d 73 74 | 61 74 69 63 20 61 76 61 | */..st|atic ava|
|00002840| 69 6c 5f 65 6c 65 6d 0d | 67 65 74 5f 62 6c 6f 63 |il_elem.|get_bloc|
|00002850| 6b 20 28 73 69 7a 65 2c | 20 64 62 66 29 0d 20 20 |k (size,| dbf). |
|00002860| 20 20 20 69 6e 74 20 73 | 69 7a 65 3b 0d 20 20 20 | int s|ize;. |
|00002870| 20 20 67 64 62 6d 5f 66 | 69 6c 65 5f 69 6e 66 6f | gdbm_f|ile_info|
|00002880| 20 2a 64 62 66 3b 0d 7b | 0d 20 20 61 76 61 69 6c | *dbf;.{|. avail|
|00002890| 5f 65 6c 65 6d 20 76 61 | 6c 3b 0d 0d 20 20 2f 2a |_elem va|l;.. /*|
|000028a0| 20 4e 65 65 64 20 61 74 | 20 6c 65 61 73 74 20 6f | Need at| least o|
|000028b0| 6e 65 20 62 6c 6f 63 6b | 2e 20 2a 2f 0d 20 20 76 |ne block|. */. v|
|000028c0| 61 6c 2e 61 76 5f 61 64 | 72 20 20 3d 20 64 62 66 |al.av_ad|r = dbf|
|000028d0| 2d 3e 68 65 61 64 65 72 | 2d 3e 6e 65 78 74 5f 62 |->header|->next_b|
|000028e0| 6c 6f 63 6b 3b 0d 20 20 | 76 61 6c 2e 61 76 5f 73 |lock;. |val.av_s|
|000028f0| 69 7a 65 20 3d 20 64 62 | 66 2d 3e 68 65 61 64 65 |ize = db|f->heade|
|00002900| 72 2d 3e 62 6c 6f 63 6b | 5f 73 69 7a 65 3b 0d 0d |r->block|_size;..|
|00002910| 20 20 2f 2a 20 47 65 74 | 20 65 6e 6f 75 67 68 20 | /* Get| enough |
|00002920| 62 6c 6f 63 6b 73 20 74 | 6f 20 66 69 74 20 74 68 |blocks t|o fit th|
|00002930| 65 20 6e 65 65 64 2e 20 | 2a 2f 0d 20 20 77 68 69 |e need. |*/. whi|
|00002940| 6c 65 20 28 76 61 6c 2e | 61 76 5f 73 69 7a 65 20 |le (val.|av_size |
|00002950| 3c 20 73 69 7a 65 29 0d | 20 20 20 20 76 61 6c 2e |< size).| val.|
|00002960| 61 76 5f 73 69 7a 65 20 | 2b 3d 20 64 62 66 2d 3e |av_size |+= dbf->|
|00002970| 68 65 61 64 65 72 2d 3e | 62 6c 6f 63 6b 5f 73 69 |header->|block_si|
|00002980| 7a 65 3b 0d 0d 20 20 2f | 2a 20 55 70 64 61 74 65 |ze;.. /|* Update|
|00002990| 20 74 68 65 20 68 65 61 | 64 65 72 20 61 6e 64 20 | the hea|der and |
|000029a0| 72 65 74 75 72 6e 2e 20 | 2a 2f 0d 20 20 64 62 66 |return. |*/. dbf|
|000029b0| 2d 3e 68 65 61 64 65 72 | 2d 3e 6e 65 78 74 5f 62 |->header|->next_b|
|000029c0| 6c 6f 63 6b 20 2b 3d 20 | 76 61 6c 2e 61 76 5f 73 |lock += |val.av_s|
|000029d0| 69 7a 65 3b 0d 0d 20 20 | 2f 2a 20 57 65 20 63 68 |ize;.. |/* We ch|
|000029e0| 61 6e 67 65 64 20 74 68 | 65 20 68 65 61 64 65 72 |anged th|e header|
|000029f0| 2e 20 2a 2f 0d 20 20 64 | 62 66 2d 3e 68 65 61 64 |. */. d|bf->head|
|00002a00| 65 72 5f 63 68 61 6e 67 | 65 64 20 3d 20 54 52 55 |er_chang|ed = TRU|
|00002a10| 45 3b 0d 0d 20 20 72 65 | 74 75 72 6e 20 76 61 6c |E;.. re|turn val|
|00002a20| 3b 0d 20 20 0d 7d 0d 0d | 0d 2f 2a 20 20 57 68 65 |;. .}..|./* Whe|
|00002a30| 6e 20 74 68 65 20 68 65 | 61 64 65 72 20 61 6c 72 |n the he|ader alr|
|00002a40| 65 61 64 79 20 6e 65 65 | 64 73 20 77 72 69 74 69 |eady nee|ds writi|
|00002a50| 6e 67 2c 20 77 65 20 63 | 61 6e 20 6d 61 6b 65 20 |ng, we c|an make |
|00002a60| 73 75 72 65 20 74 68 65 | 20 63 75 72 72 65 6e 74 |sure the| current|
|00002a70| 0d 20 20 20 20 62 75 63 | 6b 65 74 20 68 61 73 20 |. buc|ket has |
|00002a80| 69 74 73 20 61 76 61 69 | 6c 20 62 6c 6f 63 6b 20 |its avai|l block |
|00002a90| 61 73 20 63 6c 6f 73 65 | 20 74 6f 20 31 2f 32 20 |as close| to 1/2 |
|00002aa0| 66 75 6c 6c 20 61 73 20 | 70 6f 73 73 69 62 6c 65 |full as |possible|
|00002ab0| 2e 20 2a 2f 0d 73 74 61 | 74 69 63 0d 61 64 6a 75 |. */.sta|tic.adju|
|00002ac0| 73 74 5f 62 75 63 6b 65 | 74 5f 61 76 61 69 6c 20 |st_bucke|t_avail |
|00002ad0| 28 64 62 66 29 0d 20 20 | 20 20 20 67 64 62 6d 5f |(dbf). | gdbm_|
|00002ae0| 66 69 6c 65 5f 69 6e 66 | 6f 20 2a 64 62 66 3b 0d |file_inf|o *dbf;.|
|00002af0| 7b 0d 20 20 69 6e 74 20 | 74 68 69 72 64 20 3d 20 |{. int |third = |
|00002b00| 42 55 43 4b 45 54 5f 41 | 56 41 49 4c 20 2f 20 33 |BUCKET_A|VAIL / 3|
|00002b10| 3b 0d 20 20 61 76 61 69 | 6c 5f 65 6c 65 6d 20 61 |;. avai|l_elem a|
|00002b20| 76 5f 65 6c 3b 0d 0d 20 | 20 2f 2a 20 43 61 6e 20 |v_el;.. | /* Can |
|00002b30| 77 65 20 61 64 64 20 6d | 6f 72 65 20 65 6e 74 72 |we add m|ore entr|
|00002b40| 69 65 73 20 74 6f 20 74 | 68 65 20 62 75 63 6b 65 |ies to t|he bucke|
|00002b50| 74 3f 20 2a 2f 0d 20 20 | 69 66 20 28 64 62 66 2d |t? */. |if (dbf-|
|00002b60| 3e 62 75 63 6b 65 74 2d | 3e 61 76 5f 63 6f 75 6e |>bucket-|>av_coun|
|00002b70| 74 20 3c 20 74 68 69 72 | 64 29 0d 20 20 20 20 7b |t < thir|d). {|
|00002b80| 0d 20 20 20 20 20 20 69 | 66 20 28 64 62 66 2d 3e |. i|f (dbf->|
|00002b90| 68 65 61 64 65 72 2d 3e | 61 76 61 69 6c 2e 63 6f |header->|avail.co|
|00002ba0| 75 6e 74 20 3e 20 30 29 | 0d 09 7b 0d 09 20 20 64 |unt > 0)|..{.. d|
|00002bb0| 62 66 2d 3e 68 65 61 64 | 65 72 2d 3e 61 76 61 69 |bf->head|er->avai|
|00002bc0| 6c 2e 63 6f 75 6e 74 20 | 2d 3d 20 31 3b 0d 09 20 |l.count |-= 1;.. |
|00002bd0| 20 61 76 5f 65 6c 20 3d | 20 64 62 66 2d 3e 68 65 | av_el =| dbf->he|
|00002be0| 61 64 65 72 2d 3e 61 76 | 61 69 6c 2e 61 76 5f 74 |ader->av|ail.av_t|
|00002bf0| 61 62 6c 65 5b 64 62 66 | 2d 3e 68 65 61 64 65 72 |able[dbf|->header|
|00002c00| 2d 3e 61 76 61 69 6c 2e | 63 6f 75 6e 74 5d 3b 0d |->avail.|count];.|
|00002c10| 09 20 20 5f 67 64 62 6d | 5f 70 75 74 5f 61 76 5f |. _gdbm|_put_av_|
|00002c20| 65 6c 65 6d 20 28 61 76 | 5f 65 6c 2c 20 64 62 66 |elem (av|_el, dbf|
|00002c30| 2d 3e 62 75 63 6b 65 74 | 2d 3e 62 75 63 6b 65 74 |->bucket|->bucket|
|00002c40| 5f 61 76 61 69 6c 2c 0d | 09 09 09 20 20 20 20 20 |_avail,.|... |
|00002c50| 26 64 62 66 2d 3e 62 75 | 63 6b 65 74 2d 3e 61 76 |&dbf->bu|cket->av|
|00002c60| 5f 63 6f 75 6e 74 29 3b | 0d 09 20 20 64 62 66 2d |_count);|.. dbf-|
|00002c70| 3e 62 75 63 6b 65 74 5f | 63 68 61 6e 67 65 64 20 |>bucket_|changed |
|00002c80| 3d 20 54 52 55 45 3b 0d | 09 7d 0d 20 20 20 20 20 |= TRUE;.|.}. |
|00002c90| 20 72 65 74 75 72 6e 3b | 0d 20 20 20 20 7d 0d 0d | return;|. }..|
|00002ca0| 20 20 2f 2a 20 49 73 20 | 74 68 65 72 65 20 74 6f | /* Is |there to|
|00002cb0| 6f 20 6d 75 63 68 20 69 | 6e 20 74 68 65 20 62 75 |o much i|n the bu|
|00002cc0| 63 6b 65 74 3f 20 2a 2f | 0d 20 20 77 68 69 6c 65 |cket? */|. while|
|00002cd0| 20 28 64 62 66 2d 3e 62 | 75 63 6b 65 74 2d 3e 61 | (dbf->b|ucket->a|
|00002ce0| 76 5f 63 6f 75 6e 74 20 | 3e 20 42 55 43 4b 45 54 |v_count |> BUCKET|
|00002cf0| 5f 41 56 41 49 4c 2d 74 | 68 69 72 64 0d 09 20 26 |_AVAIL-t|hird.. &|
|00002d00| 26 20 64 62 66 2d 3e 68 | 65 61 64 65 72 2d 3e 61 |& dbf->h|eader->a|
|00002d10| 76 61 69 6c 2e 63 6f 75 | 6e 74 20 3c 20 64 62 66 |vail.cou|nt < dbf|
|00002d20| 2d 3e 68 65 61 64 65 72 | 2d 3e 61 76 61 69 6c 2e |->header|->avail.|
|00002d30| 73 69 7a 65 29 0d 20 20 | 20 20 7b 0d 20 20 20 20 |size). | {. |
|00002d40| 20 20 61 76 5f 65 6c 20 | 3d 20 67 65 74 5f 65 6c | av_el |= get_el|
|00002d50| 65 6d 20 28 30 2c 20 64 | 62 66 2d 3e 62 75 63 6b |em (0, d|bf->buck|
|00002d60| 65 74 2d 3e 62 75 63 6b | 65 74 5f 61 76 61 69 6c |et->buck|et_avail|
|00002d70| 2c 20 26 64 62 66 2d 3e | 62 75 63 6b 65 74 2d 3e |, &dbf->|bucket->|
|00002d80| 61 76 5f 63 6f 75 6e 74 | 29 3b 0d 20 20 20 20 20 |av_count|);. |
|00002d90| 20 5f 67 64 62 6d 5f 70 | 75 74 5f 61 76 5f 65 6c | _gdbm_p|ut_av_el|
|00002da0| 65 6d 20 28 61 76 5f 65 | 6c 2c 20 64 62 66 2d 3e |em (av_e|l, dbf->|
|00002db0| 68 65 61 64 65 72 2d 3e | 61 76 61 69 6c 2e 61 76 |header->|avail.av|
|00002dc0| 5f 74 61 62 6c 65 2c 0d | 09 09 09 20 26 64 62 66 |_table,.|... &dbf|
|00002dd0| 2d 3e 68 65 61 64 65 72 | 2d 3e 61 76 61 69 6c 2e |->header|->avail.|
|00002de0| 63 6f 75 6e 74 29 3b 0d | 20 20 20 20 20 20 64 62 |count);.| db|
|00002df0| 66 2d 3e 62 75 63 6b 65 | 74 5f 63 68 61 6e 67 65 |f->bucke|t_change|
|00002e00| 64 20 3d 20 54 52 55 45 | 3b 0d 20 20 20 20 7d 0d |d = TRUE|;. }.|
|00002e10| 7d 0d 0d 0d 00 00 00 00 | 00 00 00 00 00 00 00 00 |}.......|........|
|00002e20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e80| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00002e90| 61 74 69 6f 6e 20 66 75 | 6e 63 74 69 6f 6e 73 0d |ation fu|nctions.|
|00002ea0| 20 2a 2f 0d 0d 63 6c 6f | 63 6b 5f 74 20 63 6c 6f | */..clo|ck_t clo|
|00002eb0| 08 66 61 6c 6c 6f 63 2e | 63 00 02 00 00 00 00 00 |.falloc.|c.......|
|00002ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ef0| 00 00 a6 ea ac f4 00 00 | 2d 94 00 00 01 ac 43 6f |........|-.....Co|
|00002f00| 75 6e 74 28 29 20 2a 2f | 0d 70 61 73 63 61 6c 20 |unt() */|.pascal |
|00002f10| 75 6e 73 69 67 6e 65 64 | 20 6c 6f 6e 67 20 5f 5f |unsigned| long __|
|00002f20| 74 69 63 6b 63 6f 75 6e | 74 28 76 6f 69 64 29 0d |tickcoun|t(void).|
|00002f30| 20 20 20 20 3d 20 30 78 | 41 39 37 35 3b 20 0d 0d | = 0x|A975; ..|
|00002f40| 64 6f 75 62 6c 65 20 20 | 64 69 66 66 74 69 6d 65 |double |difftime|
|00002f50| 28 74 69 6d 65 5f 74 20 | 74 69 6d 65 31 2c 20 74 |(time_t |time1, t|
|00002f60| 69 6d 65 5f 74 20 74 69 | 6d 65 30 29 3b 20 20 20 |ime_t ti|me0); |
|00002f70| 20 20 20 20 20 09 09 2f | 2a 20 66 75 6e 63 74 69 | ../|* functi|
|00002f80| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 64 62 6d |...H..Mo|naco.dbm|
|00002f90| 2e 20 2a 2f 0d 0d 2f 2a | 20 20 54 68 69 73 20 66 |. */../*| This f|
|00002fa0| 69 6c 65 20 69 73 00 06 | 00 08 00 78 00 18 01 dd |ile is..|...x....|
|00002fb0| 02 3d 00 78 00 18 01 dd | 02 3d a6 04 b8 33 00 00 |.=.x....|.=...3..|
|00002fc0| 16 69 00 00 16 69 00 00 | 15 1b 01 00 00 00 00 1e |.i...i..|........|
|00002fd0| 00 78 00 18 01 dd 02 3d | 00 78 00 18 01 dd 02 3d |.x.....=|.x.....=|
|00002fe0| 00 00 15 1b 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ff0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 54 |.....n..|.n...>.T|
|00003000| 46 a4 0c dc 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |F.......|.>..MPSR|
|00003010| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00003020| 03 f0 ff ff 00 00 00 4c | 00 5a 6a f8 00 00 00 00 |.......L|.Zj.....|
|00003030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003060| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+