home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: DOS BACKUP file
(archive/dosBackupFile).
You can browse this item here: BTRISRT.C
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| DOS BACKUP file (archive/dosBackupFile)
| magic
| Supported |
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
100%
| file
| DOS 2.0-3.2 backed up file \CBTREE\LIBRARY\BTRISRT.C
| default
| |
99%
| file
| data
| default
| |
51%
| TrID
| DOS 2.0-3.2 backup
| default
| |
48%
| TrID
| MP3 audio
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| ff 01 00 00 00 5c 43 42 | 54 52 45 45 5c 4c 49 42 |.....\CB|TREE\LIB|
|00000010| 52 41 52 59 5c 42 54 52 | 49 53 52 54 2e 43 00 00 |RARY\BTR|ISRT.C..|
|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 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 1a 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000080| 2f 2a 20 28 43 29 20 43 | 6f 70 79 72 69 67 68 74 |/* (C) C|opyright|
|00000090| 20 31 39 38 34 2c 38 35 | 2c 38 36 2c 38 37 20 57 | 1984,85|,86,87 W|
|000000a0| 61 6c 74 65 72 20 4c 2e | 20 50 65 61 63 6f 63 6b |alter L.| Peacock|
|000000b0| 20 20 20 41 6c 6c 20 52 | 69 67 68 74 73 20 52 65 | All R|ights Re|
|000000c0| 73 65 72 76 65 64 20 20 | 20 20 2a 2f 0d 0a 0d 0a |served | */....|
|000000d0| 2f 2a 20 62 20 74 20 72 | 20 69 20 73 20 72 20 74 |/* b t r| i s r t|
|000000e0| 20 2e 20 63 20 3a 20 20 | 20 20 20 20 20 20 20 20 | . c : | |
|000000f0| 20 20 20 20 20 20 69 6e | 73 65 72 74 20 66 75 6e | in|sert fun|
|00000100| 63 74 69 6f 6e 20 66 6f | 72 20 69 6e 73 65 72 74 |ction fo|r insert|
|00000110| 20 63 61 6c 6c 20 20 20 | 20 20 2a 2f 0d 0a 2f 2a | call | */../*|
|00000120| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000130| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000140| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000150| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000160| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 0d 0a 20 2a |--------|----.. *|
|00000170| 20 62 74 72 69 73 72 74 | 28 29 20 70 72 6f 63 65 | btrisrt|() proce|
|00000180| 73 73 65 73 20 61 6c 6c | 20 49 4e 53 45 52 54 20 |sses all| INSERT |
|00000190| 61 6e 64 20 49 53 52 54 | 4b 59 20 63 61 6c 6c 73 |and ISRT|KY calls|
|000001a0| 2e 20 20 49 74 20 69 6e | 76 6f 6b 65 73 20 6f 74 |. It in|vokes ot|
|000001b0| 68 65 72 0d 0a 20 2a 20 | 6c 6f 77 65 72 2d 6c 65 |her.. * |lower-le|
|000001c0| 76 65 6c 20 42 2b 74 72 | 65 65 20 66 75 6e 63 74 |vel B+tr|ee funct|
|000001d0| 69 6f 6e 73 20 61 73 20 | 6e 65 65 64 65 64 20 74 |ions as |needed t|
|000001e0| 6f 20 6d 61 69 6e 74 61 | 69 6e 20 74 68 65 20 42 |o mainta|in the B|
|000001f0| 2b 74 72 65 65 2e 0d 0a | 20 2a 2d 2d 2d 2d 2d 2d |+tree...| *------|
|00000200| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000210| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000220| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000230| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000240| 2d 2d 2d 2d 2d 2a 2f 0d | 0a 0d 0a 23 69 6e 63 6c |-----*/.|...#incl|
|00000250| 75 64 65 20 22 63 62 74 | 72 65 65 2e 68 22 0d 0a |ude "cbt|ree.h"..|
|00000260| 0d 0a 62 74 72 69 73 72 | 74 28 66 64 64 74 61 2c |..btrisr|t(fddta,|
|00000270| 20 66 64 69 64 78 2c 20 | 69 64 78 62 6c 6b 2c 20 | fdidx, |idxblk, |
|00000280| 68 64 72 6c 6f 63 2c 20 | 6e 6f 64 65 2c 20 72 6f |hdrloc, |node, ro|
|00000290| 6f 74 70 74 72 2c 20 62 | 74 63 70 29 0d 0a 0d 0a |otptr, b|tcp)....|
|000002a0| 42 54 43 20 2a 62 74 63 | 70 3b 0d 0a 73 74 72 75 |BTC *btc|p;..stru|
|000002b0| 63 74 20 62 74 69 64 78 | 62 6c 6b 20 2a 69 64 78 |ct btidx|blk *idx|
|000002c0| 62 6c 6b 3b 0d 0a 69 6e | 74 20 66 64 64 74 61 2c |blk;..in|t fddta,|
|000002d0| 20 66 64 69 64 78 2c 20 | 68 64 72 6c 6f 63 3b 0d | fdidx, |hdrloc;.|
|000002e0| 0a 6c 6f 6e 67 20 6e 6f | 64 65 2c 20 72 6f 6f 74 |.long no|de, root|
|000002f0| 70 74 72 3b 0d 0a 7b 0d | 0a 20 20 20 65 78 74 65 |ptr;..{.|. exte|
|00000300| 72 6e 20 6c 6f 6e 67 20 | 67 69 76 65 69 64 78 72 |rn long |giveidxr|
|00000310| 28 29 2c 20 70 75 73 68 | 64 6f 77 6e 28 29 2c 20 |(), push|down(), |
|00000320| 70 6f 70 74 6f 70 28 29 | 2c 20 6c 73 65 65 6b 28 |poptop()|, lseek(|
|00000330| 29 3b 0d 0a 20 20 20 65 | 78 74 65 72 6e 20 69 6e |);.. e|xtern in|
|00000340| 74 20 73 74 72 63 6d 70 | 28 29 2c 20 73 74 72 6c |t strcmp|(), strl|
|00000350| 65 6e 28 29 3b 0d 0a 20 | 20 20 65 78 74 65 72 6e |en();.. | extern|
|00000360| 20 63 68 61 72 20 2a 73 | 74 72 63 70 79 28 29 2c | char *s|trcpy(),|
|00000370| 20 2a 63 61 6c 6c 6f 63 | 28 29 3b 0d 0a 20 20 20 | *calloc|();.. |
|00000380| 65 78 74 65 72 6e 20 76 | 6f 69 64 20 66 72 65 65 |extern v|oid free|
|00000390| 28 29 3b 0d 0a 20 20 20 | 65 78 74 65 72 6e 20 6c |();.. |extern l|
|000003a0| 6f 6e 67 20 6c 6f 63 6b | 6c 69 73 74 5b 5d 3b 0d |ong lock|list[];.|
|000003b0| 0a 20 20 20 65 78 74 65 | 72 6e 20 69 6e 74 20 20 |. exte|rn int |
|000003c0| 6c 6f 63 6b 70 74 72 3b | 0d 0a 20 20 20 42 54 49 |lockptr;|.. BTI|
|000003d0| 44 58 42 4c 4b 20 2a 6e | 75 69 64 78 62 6c 6b 2c |DXBLK *n|uidxblk,|
|000003e0| 20 2a 69 64 78 70 3b 0d | 0a 20 20 20 6c 6f 6e 67 | *idxp;.|. long|
|000003f0| 20 6e 65 77 6e 6f 64 65 | 2c 20 70 6f 73 3b 0d 0a | newnode|, pos;..|
|00000400| 20 20 20 69 6e 74 20 68 | 6c 6f 63 2c 20 6c 6b 3b | int h|loc, lk;|
|00000410| 0d 0a 20 20 20 63 68 61 | 72 20 2a 6e 65 77 6b 65 |.. cha|r *newke|
|00000420| 79 3b 0d 0a 20 20 20 75 | 69 6e 74 20 73 70 6c 69 |y;.. u|int spli|
|00000430| 74 70 74 3b 0d 0a 0d 0a | 20 20 20 2f 2a 2a 2a 2a |tpt;....| /****|
|00000440| 20 4e 45 57 4c 4f 43 20 | 2a 2a 2a 2a 2f 0d 0a 0d | NEWLOC |****/...|
|00000450| 0a 20 20 20 69 66 20 28 | 62 74 63 70 2d 3e 62 74 |. if (|btcp->bt|
|00000460| 6f 70 74 79 70 65 20 3d | 3d 20 4e 45 57 4c 4f 43 |optype =|= NEWLOC|
|00000470| 29 0d 0a 20 20 20 7b 0d | 0a 20 20 20 20 20 20 69 |).. {.|. i|
|00000480| 66 20 28 62 74 63 70 2d | 3e 62 74 6c 6f 63 20 3e |f (btcp-|>btloc >|
|00000490| 20 30 29 20 20 20 2f 2a | 20 77 65 27 72 65 20 6c | 0) /*| we're l|
|000004a0| 6f 63 61 74 65 64 20 73 | 6f 6d 65 77 68 65 72 65 |ocated s|omewhere|
|000004b0| 20 21 20 2a 2f 0d 0a 20 | 20 20 20 20 20 7b 20 20 | ! */.. | { |
|000004c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000004d0| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 66 69 6e | | /* fin|
|000004e0| 64 20 63 6f 6e 74 69 6e | 75 61 74 69 6f 6e 20 70 |d contin|uation p|
|000004f0| 6f 69 6e 74 20 20 20 2a | 2f 0d 0a 20 20 20 20 20 |oint *|/.. |
|00000500| 20 20 20 20 77 68 69 6c | 65 20 28 62 74 63 70 2d | whil|e (btcp-|
|00000510| 3e 62 74 6c 6f 63 20 21 | 3d 20 69 64 78 62 6c 6b |>btloc !|= idxblk|
|00000520| 2d 3e 62 74 70 61 67 65 | 5b 68 64 72 6c 6f 63 5d |->btpage|[hdrloc]|
|00000530| 2e 62 74 70 74 72 29 0d | 0a 20 20 20 20 20 20 20 |.btptr).|. |
|00000540| 20 20 7b 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 | {.. | |
|00000550| 20 69 66 20 28 28 68 64 | 72 6c 6f 63 20 3d 20 77 | if ((hd|rloc = w|
|00000560| 72 61 70 5f 68 64 72 28 | 68 64 72 6c 6f 63 2b 31 |rap_hdr(|hdrloc+1|
|00000570| 2c 20 69 64 78 62 6c 6b | 2c 20 66 64 69 64 78 2c |, idxblk|, fdidx,|
|00000580| 20 62 74 63 70 29 29 0d | 0a 20 20 20 20 20 20 20 | btcp)).|. |
|00000590| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000005a0| 20 3d 3d 20 42 54 4e 4f | 54 46 4e 44 29 0d 0a 20 | == BTNO|TFND).. |
|000005b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 72 65 | | re|
|000005c0| 74 75 72 6e 20 28 42 54 | 4e 4f 54 46 4e 44 29 3b |turn (BT|NOTFND);|
|000005d0| 0d 0a 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |.... | |
|000005e0| 69 66 20 28 73 74 72 63 | 6d 70 28 62 74 63 70 2d |if (strc|mp(btcp-|
|000005f0| 3e 62 74 6b 65 79 2c 20 | 69 64 78 62 6c 6b 2d 3e |>btkey, |idxblk->|
|00000600| 62 74 70 61 67 65 5b 68 | 64 72 6c 6f 63 5d 2e 73 |btpage[h|drloc].s|
|00000610| 6b 65 79 6e 6d 65 29 20 | 3e 20 30 29 0d 0a 20 20 |keynme) |> 0).. |
|00000620| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 72 65 74 | | ret|
|00000630| 75 72 6e 28 42 54 4e 4f | 54 46 4e 44 29 3b 0d 0a |urn(BTNO|TFND);..|
|00000640| 20 20 20 20 20 20 20 20 | 20 7d 0d 0a 20 20 20 20 | | }.. |
|00000650| 20 20 7d 20 20 20 20 2f | 2a 20 65 6e 64 20 69 66 | } /|* end if|
|00000660| 20 28 62 74 6c 6f 63 20 | 3e 20 30 29 20 2a 2f 0d | (btloc |> 0) */.|
|00000670| 0a 0d 0a 20 20 20 20 20 | 20 2f 2a 20 73 65 74 20 |... | /* set |
|00000680| 62 74 6c 6f 63 20 74 6f | 20 6e 65 77 20 6c 6f 63 |btloc to| new loc|
|00000690| 61 74 69 6f 6e 20 2a 2f | 0d 0a 20 20 20 20 20 20 |ation */|.. |
|000006a0| 62 74 63 70 2d 3e 62 74 | 6c 6f 63 20 3d 20 69 64 |btcp->bt|loc = id|
|000006b0| 78 62 6c 6b 2d 3e 62 74 | 70 61 67 65 5b 68 64 72 |xblk->bt|page[hdr|
|000006c0| 6c 6f 63 5d 2e 62 74 70 | 74 72 20 3d 20 2a 62 74 |loc].btp|tr = *bt|
|000006d0| 63 70 2d 3e 62 74 72 65 | 63 6e 75 6d 3b 0d 0a 0d |cp->btre|cnum;...|
|000006e0| 0a 20 20 20 20 20 20 2f | 2a 20 61 6e 64 20 77 72 |. /|* and wr|
|000006f0| 69 74 65 20 69 74 20 6f | 75 74 20 2a 2f 0d 0a 20 |ite it o|ut */.. |
|00000700| 20 20 20 20 20 70 75 74 | 69 64 78 72 28 66 64 69 | put|idxr(fdi|
|00000710| 64 78 2c 20 6e 6f 64 65 | 2c 20 69 64 78 62 6c 6b |dx, node|, idxblk|
|00000720| 2c 20 62 74 63 70 29 3b | 0d 0a 0d 0a 20 20 20 20 |, btcp);|.... |
|00000730| 20 20 72 65 74 75 72 6e | 28 42 54 43 41 4c 4c 4f | return|(BTCALLO|
|00000740| 4b 29 3b 0d 0a 20 20 20 | 7d 0d 0a 0d 0a 20 20 20 |K);.. |}.... |
|00000750| 2f 2a 2a 2a 2a 20 49 4e | 53 45 52 54 20 61 6e 64 |/**** IN|SERT and|
|00000760| 20 49 53 52 54 4b 59 20 | 2a 2a 2a 2a 2f 0d 0a 0d | ISRTKY |****/...|
|00000770| 0a 20 20 20 69 66 28 69 | 64 78 62 6c 6b 2d 3e 63 |. if(i|dxblk->c|
|00000780| 65 6c 6c 69 63 6e 74 20 | 3c 20 62 74 63 70 2d 3e |ellicnt |< btcp->|
|00000790| 62 74 63 65 6c 6c 73 29 | 20 20 20 2f 2a 20 77 65 |btcells)| /* we|
|000007a0| 20 68 61 76 65 20 72 6f | 6f 6d 20 66 6f 72 20 6e | have ro|om for n|
|000007b0| 65 77 20 6b 65 79 20 2a | 2f 0d 0a 20 20 20 7b 0d |ew key *|/.. {.|
|000007c0| 0a 0d 0a 20 20 20 20 20 | 20 69 6e 73 65 72 74 6b |... | insertk|
|000007d0| 79 28 69 64 78 62 6c 6b | 2c 20 68 64 72 6c 6f 63 |y(idxblk|, hdrloc|
|000007e0| 2c 20 62 74 63 70 2d 3e | 62 74 6b 65 79 2c 20 62 |, btcp->|btkey, b|
|000007f0| 74 63 70 2d 3e 62 74 6b | 65 79 6c 65 6e 29 3b 0d |tcp->btk|eylen);.|
|00000800| 0a 0d 0a 20 20 20 20 20 | 20 69 66 20 28 62 74 63 |... | if (btc|
|00000810| 70 2d 3e 62 74 6f 70 74 | 79 70 65 20 3d 3d 20 49 |p->btopt|ype == I|
|00000820| 4e 53 45 52 54 29 20 2f | 2a 20 61 6c 6c 6f 63 20 |NSERT) /|* alloc |
|00000830| 6e 65 77 20 64 61 74 61 | 20 72 65 63 2e 20 28 6c |new data| rec. (l|
|00000840| 6f 63 6b 65 64 29 20 2a | 2f 0d 0a 20 20 20 20 20 |ocked) *|/.. |
|00000850| 20 7b 0d 0a 20 20 20 20 | 20 20 20 20 20 62 74 63 | {.. | btc|
|00000860| 70 2d 3e 62 74 6c 6f 63 | 20 3d 20 69 64 78 62 6c |p->btloc| = idxbl|
|00000870| 6b 2d 3e 62 74 70 61 67 | 65 5b 68 64 72 6c 6f 63 |k->btpag|e[hdrloc|
|00000880| 5d 2e 62 74 70 74 72 20 | 3d 20 62 74 63 70 2d 3e |].btptr |= btcp->|
|00000890| 62 74 76 61 72 6c 65 6e | 20 3f 0d 0a 20 20 20 20 |btvarlen| ?.. |
|000008a0| 20 20 20 20 20 20 20 20 | 20 20 20 62 74 67 69 76 | | btgiv|
|000008b0| 76 61 72 28 66 64 64 74 | 61 2c 20 62 74 63 70 2d |var(fddt|a, btcp-|
|000008c0| 3e 62 74 64 74 61 6c 65 | 6e 29 20 3a 0d 0a 20 20 |>btdtale|n) :.. |
|000008d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 67 69 76 | | giv|
|000008e0| 65 69 64 78 72 28 66 64 | 64 74 61 2c 20 62 74 63 |eidxr(fd|dta, btc|
|000008f0| 70 2d 3e 62 74 64 74 61 | 6c 65 6e 2c 20 30 2c 20 |p->btdta|len, 0, |
|00000900| 31 29 20 3b 0d 0a 20 20 | 20 20 20 20 7d 0d 0a 20 |1) ;.. | }.. |
|00000910| 20 20 20 20 20 65 6c 73 | 65 20 20 20 20 20 20 20 | els|e |
|00000920| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 70 6c 61 63 | | /* plac|
|00000930| 65 20 72 65 63 20 70 6f | 69 6e 74 65 72 20 69 6e |e rec po|inter in|
|00000940| 74 6f 20 6e 6f 64 65 20 | 63 65 6c 6c 20 2a 2f 0d |to node |cell */.|
|00000950| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 69 64 78 |. | idx|
|00000960| 62 6c 6b 2d 3e 62 74 70 | 61 67 65 5b 68 64 72 6c |blk->btp|age[hdrl|
|00000970| 6f 63 5d 2e 62 74 70 74 | 72 20 3d 20 62 74 63 70 |oc].btpt|r = btcp|
|00000980| 2d 3e 62 74 6c 6f 63 3b | 0d 0a 0d 0a 20 20 20 20 |->btloc;|.... |
|00000990| 20 20 2f 2a 20 77 72 69 | 74 65 20 74 68 65 20 69 | /* wri|te the i|
|000009a0| 6e 64 65 78 20 72 65 63 | 6f 72 64 20 74 6f 20 64 |ndex rec|ord to d|
|000009b0| 69 73 6b 20 20 2a 2f 0d | 0a 20 20 20 20 20 20 70 |isk */.|. p|
|000009c0| 75 74 69 64 78 72 28 66 | 64 69 64 78 2c 20 6e 6f |utidxr(f|didx, no|
|000009d0| 64 65 2c 20 69 64 78 62 | 6c 6b 2c 20 62 74 63 70 |de, idxb|lk, btcp|
|000009e0| 29 3b 0d 0a 0d 0a 20 20 | 20 20 20 20 72 65 74 75 |);.... | retu|
|000009f0| 72 6e 28 42 54 43 41 4c | 4c 4f 4b 29 3b 20 20 20 |rn(BTCAL|LOK); |
|00000a00| 20 20 2f 2a 20 72 65 74 | 75 72 6e 20 74 6f 20 63 | /* ret|urn to c|
|00000a10| 61 6c 6c 69 6e 67 20 70 | 67 6d 2e 20 2a 2f 0d 0a |alling p|gm. */..|
|00000a20| 20 20 20 7d 0d 0a 0d 0a | 20 20 20 2f 2a 2a 2a 2a | }....| /****|
|00000a30| 20 53 50 4c 49 54 20 54 | 48 45 20 4e 4f 44 45 20 | SPLIT T|HE NODE |
|00000a40| 2a 2a 2a 2a 2f 0d 0a 0d | 0a 20 20 20 2f 2a 20 74 |****/...|. /* t|
|00000a50| 68 69 73 20 6e 6f 64 65 | 20 69 73 20 66 75 6c 6c |his node| is full|
|00000a60| 3a 20 73 70 6c 69 74 20 | 6e 6f 64 65 20 61 6e 64 |: split |node and|
|00000a70| 20 69 6e 73 65 72 74 20 | 6b 65 79 20 69 6e 20 70 | insert |key in p|
|00000a80| 72 6f 70 65 72 20 6e 6f | 64 65 20 2a 2f 0d 0a 0d |roper no|de */...|
|00000a90| 0a 20 20 20 2f 2a 20 6d | 61 6b 65 20 62 75 66 66 |. /* m|ake buff|
|00000aa0| 65 72 20 66 6f 72 20 6e | 65 77 20 6e 6f 64 65 20 |er for n|ew node |
|00000ab0| 2a 2f 0d 0a 20 20 20 69 | 66 20 28 28 63 68 61 72 |*/.. i|f ((char|
|00000ac0| 20 2a 29 28 6e 75 69 64 | 78 62 6c 6b 20 3d 20 28 | *)(nuid|xblk = (|
|00000ad0| 42 54 49 44 58 42 4c 4b | 20 2a 29 63 61 6c 6c 6f |BTIDXBLK| *)callo|
|00000ae0| 63 28 0d 0a 20 20 20 20 | 20 20 20 20 20 73 69 7a |c(.. | siz|
|00000af0| 65 6f 66 28 42 54 49 44 | 58 42 4c 4b 29 20 2b 20 |eof(BTID|XBLK) + |
|00000b00| 62 74 63 70 2d 3e 62 74 | 63 65 6c 6c 73 20 2a 20 |btcp->bt|cells * |
|00000b10| 73 69 7a 65 6f 66 28 42 | 54 49 44 58 29 2c 20 53 |sizeof(B|TIDX), S|
|00000b20| 5a 43 48 41 52 29 29 20 | 3d 3d 20 4e 55 4c 4c 29 |ZCHAR)) |== NULL)|
|00000b30| 0d 0a 20 20 20 20 20 20 | 63 6b 65 72 72 6f 72 28 |.. |ckerror(|
|00000b40| 2d 20 43 4b 5f 4e 4f 4d | 45 4d 2c 20 22 33 35 22 |- CK_NOM|EM, "35"|
|00000b50| 29 3b 0d 0a 0d 0a 20 20 | 20 73 70 6c 69 74 70 74 |);.... | splitpt|
|00000b60| 20 3d 20 28 69 64 78 62 | 6c 6b 2d 3e 63 65 6c 6c | = (idxb|lk->cell|
|00000b70| 69 63 6e 74 20 2b 20 31 | 29 20 3e 3e 20 31 3b 20 |icnt + 1|) >> 1; |
|00000b80| 20 20 2f 2a 20 28 3e 3e | 20 66 6f 72 20 4c 43 20 | /* (>>| for LC |
|00000b90| 62 75 67 29 20 2a 2f 0d | 0a 20 20 20 69 66 20 28 |bug) */.|. if (|
|00000ba0| 69 64 78 62 6c 6b 2d 3e | 63 65 6c 6c 69 63 6e 74 |idxblk->|cellicnt|
|00000bb0| 20 26 20 31 29 20 20 20 | 20 2f 2a 20 63 65 6c 6c | & 1) | /* cell|
|00000bc0| 20 63 6f 75 6e 74 20 69 | 73 20 4f 44 44 20 2a 2f | count i|s ODD */|
|00000bd0| 0d 0a 20 20 20 20 20 20 | 73 70 6c 69 74 70 74 20 |.. |splitpt |
|00000be0| 2d 3d 20 28 68 64 72 6c | 6f 63 20 3c 20 73 70 6c |-= (hdrl|oc < spl|
|00000bf0| 69 74 70 74 29 3b 20 20 | 20 20 20 20 2f 2a 20 61 |itpt); | /* a|
|00000c00| 64 6a 75 73 74 20 73 70 | 6c 69 74 70 6f 69 6e 74 |djust sp|litpoint|
|00000c10| 20 2a 2f 0d 0a 0d 0a 20 | 20 20 2f 2a 20 72 65 64 | */.... | /* red|
|00000c20| 69 73 74 72 69 62 75 74 | 65 20 74 68 65 20 63 65 |istribut|e the ce|
|00000c30| 6c 6c 73 20 62 65 74 77 | 65 65 6e 20 74 68 65 20 |lls betw|een the |
|00000c40| 74 77 6f 20 6e 6f 64 65 | 73 20 2a 2f 0d 0a 20 20 |two node|s */.. |
|00000c50| 20 73 70 6c 74 6e 6f 64 | 65 28 69 64 78 62 6c 6b | spltnod|e(idxblk|
|00000c60| 2c 20 6e 75 69 64 78 62 | 6c 6b 2c 20 73 70 6c 69 |, nuidxb|lk, spli|
|00000c70| 74 70 74 29 3b 0d 0a 0d | 0a 20 20 20 2f 2a 20 20 |tpt);...|. /* |
|00000c80| 20 6e 6f 77 20 69 6e 73 | 65 72 74 20 6e 65 77 20 | now ins|ert new |
|00000c90| 6b 65 79 20 20 20 2a 2f | 0d 0a 20 20 20 69 66 20 |key */|.. if |
|00000ca0| 28 68 64 72 6c 6f 63 20 | 3c 20 73 70 6c 69 74 70 |(hdrloc |< splitp|
|00000cb0| 74 29 20 20 20 20 20 20 | 2f 2a 20 6e 65 77 20 6b |t) |/* new k|
|00000cc0| 65 79 20 67 6f 65 73 20 | 69 6e 20 54 48 49 53 20 |ey goes |in THIS |
|00000cd0| 69 6e 64 65 78 20 62 6c | 6f 63 6b 20 2a 2f 0d 0a |index bl|ock */..|
|00000ce0| 20 20 20 7b 0d 0a 20 20 | 20 20 20 20 69 64 78 70 | {.. | idxp|
|00000cf0| 20 3d 20 69 64 78 62 6c | 6b 3b 0d 0a 20 20 20 20 | = idxbl|k;.. |
|00000d00| 20 20 68 6c 6f 63 20 3d | 20 68 64 72 6c 6f 63 3b | hloc =| hdrloc;|
|00000d10| 0d 0a 20 20 20 7d 0d 0a | 20 20 20 65 6c 73 65 20 |.. }..| else |
|00000d20| 20 20 20 20 2f 2a 20 6e | 65 77 20 6b 65 79 20 67 | /* n|ew key g|
|00000d30| 6f 65 73 20 69 6e 20 54 | 48 41 54 20 69 6e 64 65 |oes in T|HAT inde|
|00000d40| 78 20 62 6c 6f 63 6b 20 | 2a 2f 0d 0a 20 20 20 7b |x block |*/.. {|
|00000d50| 0d 0a 20 20 20 20 20 20 | 69 64 78 70 20 3d 20 6e |.. |idxp = n|
|00000d60| 75 69 64 78 62 6c 6b 3b | 0d 0a 20 20 20 20 20 20 |uidxblk;|.. |
|00000d70| 68 6c 6f 63 20 3d 20 68 | 64 72 6c 6f 63 20 2d 20 |hloc = h|drloc - |
|00000d80| 28 69 6e 74 29 73 70 6c | 69 74 70 74 3b 0d 0a 20 |(int)spl|itpt;.. |
|00000d90| 20 20 7d 0d 0a 20 20 20 | 69 6e 73 65 72 74 6b 79 | }.. |insertky|
|00000da0| 28 69 64 78 70 2c 20 68 | 6c 6f 63 2c 20 62 74 63 |(idxp, h|loc, btc|
|00000db0| 70 2d 3e 62 74 6b 65 79 | 2c 20 62 74 63 70 2d 3e |p->btkey|, btcp->|
|00000dc0| 62 74 6b 65 79 6c 65 6e | 29 3b 20 20 20 20 2f 2a |btkeylen|); /*|
|00000dd0| 20 61 64 64 20 74 68 65 | 20 6b 65 79 20 2a 2f 0d | add the| key */.|
|00000de0| 0a 20 20 20 69 66 20 28 | 62 74 63 70 2d 3e 62 74 |. if (|btcp->bt|
|00000df0| 6f 70 74 79 70 65 20 3d | 3d 20 49 4e 53 45 52 54 |optype =|= INSERT|
|00000e00| 29 20 20 20 2f 2a 20 61 | 6c 6c 6f 63 61 74 65 20 |) /* a|llocate |
|00000e10| 6e 65 77 20 64 61 74 61 | 20 72 65 63 6f 72 64 20 |new data| record |
|00000e20| 2a 2f 0d 0a 20 20 20 7b | 0d 0a 20 20 20 20 20 20 |*/.. {|.. |
|00000e30| 62 74 63 70 2d 3e 62 74 | 6c 6f 63 20 3d 20 69 64 |btcp->bt|loc = id|
|00000e40| 78 70 2d 3e 62 74 70 61 | 67 65 5b 68 6c 6f 63 5d |xp->btpa|ge[hloc]|
|00000e50| 2e 62 74 70 74 72 20 3d | 20 62 74 63 70 2d 3e 62 |.btptr =| btcp->b|
|00000e60| 74 76 61 72 6c 65 6e 20 | 3f 0d 0a 20 20 20 20 20 |tvarlen |?.. |
|00000e70| 20 20 20 20 20 20 20 62 | 74 67 69 76 76 61 72 28 | b|tgivvar(|
|00000e80| 66 64 64 74 61 2c 20 62 | 74 63 70 2d 3e 62 74 64 |fddta, b|tcp->btd|
|00000e90| 74 61 6c 65 6e 29 20 3a | 0d 0a 20 20 20 20 20 20 |talen) :|.. |
|00000ea0| 20 20 20 20 20 20 67 69 | 76 65 69 64 78 72 28 66 | gi|veidxr(f|
|00000eb0| 64 64 74 61 2c 20 62 74 | 63 70 2d 3e 62 74 64 74 |ddta, bt|cp->btdt|
|00000ec0| 61 6c 65 6e 2c 20 30 2c | 20 31 29 20 3b 0d 0a 20 |alen, 0,| 1) ;.. |
|00000ed0| 20 20 7d 0d 0a 20 20 20 | 65 6c 73 65 20 20 20 20 | }.. |else |
|00000ee0| 20 20 20 20 20 20 2f 2a | 20 70 6c 61 63 65 20 72 | /*| place r|
|00000ef0| 65 63 20 70 6f 69 6e 74 | 65 72 20 69 6e 74 6f 20 |ec point|er into |
|00000f00| 6e 6f 64 65 20 63 65 6c | 6c 20 2a 2f 0d 0a 20 20 |node cel|l */.. |
|00000f10| 20 20 20 20 69 64 78 70 | 2d 3e 62 74 70 61 67 65 | idxp|->btpage|
|00000f20| 5b 68 6c 6f 63 5d 2e 62 | 74 70 74 72 20 3d 20 62 |[hloc].b|tptr = b|
|00000f30| 74 63 70 2d 3e 62 74 6c | 6f 63 3b 0d 0a 0d 0a 20 |tcp->btl|oc;.... |
|00000f40| 20 20 6e 75 69 64 78 62 | 6c 6b 2d 3e 62 6c 6b 74 | nuidxb|lk->blkt|
|00000f50| 79 70 65 20 3d 20 69 64 | 78 62 6c 6b 2d 3e 62 6c |ype = id|xblk->bl|
|00000f60| 6b 74 79 70 65 3b 20 20 | 20 2f 2a 20 73 65 74 20 |ktype; | /* set |
|00000f70| 6e 6f 64 65 20 74 79 70 | 65 20 28 62 6c 6b 74 79 |node typ|e (blkty|
|00000f80| 70 65 20 3d 20 31 29 20 | 2a 2f 0d 0a 0d 0a 20 20 |pe = 1) |*/.... |
|00000f90| 20 2f 2a 2a 2a 2a 2a 20 | 47 45 54 20 41 4e 20 49 | /***** |GET AN I|
|00000fa0| 4e 44 45 58 20 42 4c 4f | 43 4b 20 46 4f 52 20 4e |NDEX BLO|CK FOR N|
|00000fb0| 45 57 4c 59 20 43 52 45 | 41 54 45 44 20 4e 4f 44 |EWLY CRE|ATED NOD|
|00000fc0| 45 20 52 45 43 4f 52 44 | 20 2a 2a 2a 2a 2a 2f 0d |E RECORD| *****/.|
|00000fd0| 0a 0d 0a 20 20 20 2f 2a | 20 77 6f 72 6b 69 6e 67 |... /*| working|
|00000fe0| 20 62 75 66 66 65 72 20 | 66 6f 72 20 6b 65 79 20 | buffer |for key |
|00000ff0| 2a 2f 0d 0a 20 20 20 69 | 66 20 28 28 6e 65 77 6b |*/.. i|f ((newk|
|00001000| 65 79 20 3d 20 63 61 6c | 6c 6f 63 28 28 75 69 6e |ey = cal|loc((uin|
|00001010| 74 29 62 74 63 70 2d 3e | 62 74 6b 65 79 6c 65 6e |t)btcp->|btkeylen|
|00001020| 20 2b 20 31 2c 20 53 5a | 43 48 41 52 29 29 20 3d | + 1, SZ|CHAR)) =|
|00001030| 3d 20 4e 55 4c 4c 29 0d | 0a 20 20 20 20 20 20 63 |= NULL).|. c|
|00001040| 6b 65 72 72 6f 72 28 2d | 20 43 4b 5f 4e 4f 4d 45 |kerror(-| CK_NOME|
|00001050| 4d 2c 20 22 33 36 22 29 | 3b 0d 0a 0d 0a 20 20 20 |M, "36")|;.... |
|00001060| 66 6f 72 28 3b 3b 29 20 | 20 2f 2a 20 74 72 61 76 |for(;;) | /* trav|
|00001070| 65 72 73 65 20 61 6c 6c | 20 6e 65 65 64 65 64 20 |erse all| needed |
|00001080| 6c 65 76 65 6c 73 20 6f | 66 20 74 68 65 20 74 72 |levels o|f the tr|
|00001090| 65 65 20 2a 2f 0d 0a 20 | 20 20 7b 0d 0a 20 20 20 |ee */.. | {.. |
|000010a0| 20 20 20 2f 2a 20 72 65 | 63 6f 72 64 20 6c 6f 63 | /* re|cord loc|
|000010b0| 61 74 69 6f 6e 20 66 6f | 72 20 6e 65 77 20 6e 6f |ation fo|r new no|
|000010c0| 64 65 20 2a 2f 0d 0a 20 | 20 20 20 20 20 6e 65 77 |de */.. | new|
|000010d0| 6e 6f 64 65 20 3d 20 67 | 69 76 65 69 64 78 72 28 |node = g|iveidxr(|
|000010e0| 66 64 69 64 78 2c 20 62 | 74 63 70 2d 3e 62 74 69 |fdidx, b|tcp->bti|
|000010f0| 64 78 6c 65 6e 2c 20 31 | 2c 20 30 29 3b 0d 0a 20 |dxlen, 1|, 0);.. |
|00001100| 20 20 0d 0a 20 20 20 20 | 20 20 6c 6f 63 6b 6c 69 | .. | lockli|
|00001110| 73 74 5b 6c 6f 63 6b 70 | 74 72 2b 2b 5d 20 3d 20 |st[lockp|tr++] = |
|00001120| 28 6e 65 77 6e 6f 64 65 | 20 2d 20 31 4c 29 20 2a |(newnode| - 1L) *|
|00001130| 20 62 74 63 70 2d 3e 62 | 74 69 64 78 6c 65 6e 3b | btcp->b|tidxlen;|
|00001140| 0d 0a 0d 0a 20 20 20 20 | 20 20 2f 2a 20 67 65 74 |.... | /* get|
|00001150| 20 63 6f 70 79 20 6f 66 | 20 6c 61 73 74 20 6b 65 | copy of| last ke|
|00001160| 79 20 69 6e 20 6e 6f 64 | 65 20 2a 2f 0d 0a 20 20 |y in nod|e */.. |
|00001170| 20 20 20 20 73 74 72 63 | 70 79 28 6e 65 77 6b 65 | strc|py(newke|
|00001180| 79 2c 20 69 64 78 62 6c | 6b 2d 3e 62 74 70 61 67 |y, idxbl|k->btpag|
|00001190| 65 5b 69 64 78 62 6c 6b | 2d 3e 63 65 6c 6c 69 63 |e[idxblk|->cellic|
|000011a0| 6e 74 20 2d 20 31 5d 2e | 73 6b 65 79 6e 6d 65 29 |nt - 1].|skeynme)|
|000011b0| 3b 0d 0a 20 20 20 0d 0a | 20 20 20 20 20 20 6e 75 |;.. ..| nu|
|000011c0| 69 64 78 62 6c 6b 2d 3e | 62 77 64 70 61 67 65 20 |idxblk->|bwdpage |
|000011d0| 3d 20 6e 6f 64 65 3b 0d | 0a 20 20 20 20 20 20 6e |= node;.|. n|
|000011e0| 75 69 64 78 62 6c 6b 2d | 3e 66 77 64 70 61 67 65 |uidxblk-|>fwdpage|
|000011f0| 20 3d 20 69 64 78 62 6c | 6b 2d 3e 66 77 64 70 61 | = idxbl|k->fwdpa|
|00001200| 67 65 3b 0d 0a 20 20 20 | 20 20 20 69 64 78 62 6c |ge;.. | idxbl|
|00001210| 6b 2d 3e 66 77 64 70 61 | 67 65 20 3d 20 6e 65 77 |k->fwdpa|ge = new|
|00001220| 6e 6f 64 65 3b 0d 0a 20 | 20 20 0d 0a 20 20 20 20 |node;.. | .. |
|00001230| 20 20 70 75 74 69 64 78 | 72 28 66 64 69 64 78 2c | putidx|r(fdidx,|
|00001240| 20 6e 6f 64 65 2c 20 69 | 64 78 62 6c 6b 2c 20 62 | node, i|dxblk, b|
|00001250| 74 63 70 29 3b 20 20 20 | 20 2f 2a 20 77 72 69 74 |tcp); | /* writ|
|00001260| 65 20 74 68 65 20 6f 72 | 67 69 6e 61 6c 20 6e 6f |e the or|ginal no|
|00001270| 64 65 20 2a 2f 0d 0a 20 | 20 20 20 20 20 70 75 74 |de */.. | put|
|00001280| 69 64 78 72 28 66 64 69 | 64 78 2c 20 6e 65 77 6e |idxr(fdi|dx, newn|
|00001290| 6f 64 65 2c 20 6e 75 69 | 64 78 62 6c 6b 2c 20 62 |ode, nui|dxblk, b|
|000012a0| 74 63 70 29 3b 20 20 2f | 2a 20 77 72 69 74 65 20 |tcp); /|* write |
|000012b0| 74 68 65 20 6e 65 77 20 | 6e 6f 64 65 20 2a 2f 0d |the new |node */.|
|000012c0| 0a 20 20 20 0d 0a 20 20 | 20 20 20 20 2f 2a 20 75 |. .. | /* u|
|000012d0| 70 64 61 74 65 20 62 77 | 64 70 61 67 65 20 6f 66 |pdate bw|dpage of|
|000012e0| 20 66 77 64 6e 6f 64 65 | 20 74 6f 20 70 6f 69 6e | fwdnode| to poin|
|000012f0| 74 20 74 6f 20 6e 65 77 | 6e 6f 64 65 20 20 20 2a |t to new|node *|
|00001300| 2f 0d 0a 20 20 20 20 20 | 20 69 66 20 28 6e 75 69 |/.. | if (nui|
|00001310| 64 78 62 6c 6b 2d 3e 66 | 77 64 70 61 67 65 20 3e |dxblk->f|wdpage >|
|00001320| 20 31 29 0d 0a 20 20 20 | 20 20 20 7b 0d 0a 20 20 | 1).. | {.. |
|00001330| 20 20 20 20 20 20 20 2f | 2a 20 6c 6f 63 61 74 65 | /|* locate|
|00001340| 20 74 68 65 20 6f 6c 64 | 20 72 69 67 68 74 20 62 | the old| right b|
|00001350| 72 6f 74 68 65 72 20 6e | 6f 64 65 20 73 6f 20 77 |rother n|ode so w|
|00001360| 65 20 63 61 6e 20 75 70 | 64 61 74 65 20 74 68 65 |e can up|date the|
|00001370| 20 20 2a 2f 0d 0a 09 09 | 20 2f 2a 20 62 61 63 6b | */....| /* back|
|00001380| 77 61 72 64 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |ward poi|nter to |
|00001390| 70 6f 69 6e 74 20 62 61 | 63 6b 20 74 6f 20 74 68 |point ba|ck to th|
|000013a0| 65 20 6e 65 77 6c 79 20 | 69 6e 73 65 72 74 65 64 |e newly |inserted|
|000013b0| 20 6e 6f 64 65 2e 20 2a | 2f 0d 0a 09 09 20 2f 2a | node. *|/.... /*|
|000013c0| 20 70 6f 73 20 77 69 6c | 6c 20 70 6f 69 6e 74 20 | pos wil|l point |
|000013d0| 74 6f 20 62 65 67 69 6e | 6e 69 6e 67 20 6f 66 20 |to begin|ning of |
|000013e0| 6e 6f 64 65 2e 20 2a 2f | 0d 0a 20 20 20 20 20 20 |node. */|.. |
|000013f0| 20 20 20 70 6f 73 20 3d | 20 28 6e 75 69 64 78 62 | pos =| (nuidxb|
|00001400| 6c 6b 2d 3e 66 77 64 70 | 61 67 65 20 2d 20 31 4c |lk->fwdp|age - 1L|
|00001410| 29 20 2a 20 62 74 63 70 | 2d 3e 62 74 69 64 78 6c |) * btcp|->btidxl|
|00001420| 65 6e 3b 0d 0a 0d 0a 20 | 20 20 20 20 20 20 20 20 |en;.... | |
|00001430| 6c 6b 20 3d 20 30 3b 20 | 20 20 20 20 2f 2a 20 6c |lk = 0; | /* l|
|00001440| 6f 63 6b 20 74 68 65 20 | 72 65 63 6f 72 64 20 77 |ock the |record w|
|00001450| 65 20 61 72 65 20 61 62 | 6f 75 74 20 74 6f 20 6d |e are ab|out to m|
|00001460| 6f 64 69 66 79 20 2a 2f | 0d 0a 20 20 20 20 20 20 |odify */|.. |
|00001470| 20 20 20 77 68 69 6c 65 | 20 28 6c 6f 63 6b 75 6e | while| (lockun|
|00001480| 6c 6b 28 66 64 69 64 78 | 2c 20 70 6f 73 2c 20 62 |lk(fdidx|, pos, b|
|00001490| 74 63 70 2d 3e 62 74 69 | 64 78 6c 65 6e 2c 20 4c |tcp->bti|dxlen, L|
|000014a0| 4f 43 4b 52 29 20 21 3d | 20 31 29 0d 0a 20 20 20 |OCKR) !=| 1).. |
|000014b0| 20 20 20 20 20 20 20 20 | 20 69 66 20 28 2b 2b 6c | | if (++l|
|000014c0| 6b 20 3e 20 48 44 52 54 | 52 59 53 29 7b 0d 0a 20 |k > HDRT|RYS){.. |
|000014d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 66 72 | | fr|
|000014e0| 65 65 6b 65 79 73 28 6e | 75 69 64 78 62 6c 6b 29 |eekeys(n|uidxblk)|
|000014f0| 3b 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;.. | |
|00001500| 20 20 46 52 45 45 28 6e | 75 69 64 78 62 6c 6b 29 | FREE(n|uidxblk)|
|00001510| 3b 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;.. | |
|00001520| 20 20 46 52 45 45 28 6e | 65 77 6b 65 79 29 3b 0d | FREE(n|ewkey);.|
|00001530| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00001540| 72 65 74 75 72 6e 28 42 | 54 4c 4f 43 4b 29 3b 20 |return(B|TLOCK); |
|00001550| 2f 2a 20 69 2e 65 2e 20 | 75 6e 61 62 6c 65 20 74 |/* i.e. |unable t|
|00001560| 6f 20 6c 6f 63 6b 20 6c | 69 6e 6b 65 64 20 6c 69 |o lock l|inked li|
|00001570| 73 74 20 72 65 63 6f 72 | 64 20 2a 2f 0d 0a 09 09 |st recor|d */....|
|00001580| 09 7d 0d 0a 0d 0a 20 20 | 20 20 20 20 20 20 20 2f |.}.... | /|
|00001590| 2a 20 6e 6f 77 20 70 6f | 73 69 74 69 6f 6e 20 74 |* now po|sition t|
|000015a0| 6f 20 74 68 65 20 62 61 | 63 6b 77 61 72 64 20 70 |o the ba|ckward p|
|000015b0| 6f 69 6e 74 65 72 20 66 | 69 65 6c 64 20 6f 66 20 |ointer f|ield of |
|000015c0| 74 68 65 20 6e 6f 64 65 | 2e 20 20 2a 2f 0d 0a 20 |the node|. */.. |
|000015d0| 20 20 20 20 20 20 20 20 | 69 66 20 28 6c 73 65 65 | |if (lsee|
|000015e0| 6b 28 66 64 69 64 78 2c | 20 28 6c 6f 6e 67 29 20 |k(fdidx,| (long) |
|000015f0| 28 70 6f 73 20 2b 20 28 | 32 20 2a 20 73 69 7a 65 |(pos + (|2 * size|
|00001600| 6f 66 28 75 77 6f 72 64 | 29 20 2b 20 73 69 7a 65 |of(uword|) + size|
|00001610| 6f 66 28 6c 6f 6e 67 29 | 29 20 29 2c 30 29 20 3d |of(long)|) ),0) =|
|00001620| 3d 20 2d 31 4c 29 0d 0a | 20 20 20 20 20 20 20 20 |= -1L)..| |
|00001630| 20 20 20 20 63 6b 65 72 | 72 6f 72 28 2d 20 43 4b | cker|ror(- CK|
|00001640| 5f 53 45 45 4b 2c 20 22 | 33 37 22 29 3b 0d 0a 0d |_SEEK, "|37");...|
|00001650| 0a 20 20 20 20 20 20 20 | 20 20 2f 2a 20 75 70 64 |. | /* upd|
|00001660| 61 74 65 20 74 68 65 20 | 70 6f 69 6e 74 65 72 20 |ate the |pointer |
|00001670| 2a 2f 0d 0a 20 20 20 20 | 20 20 20 20 20 69 66 20 |*/.. | if |
|00001680| 28 77 72 69 74 65 28 66 | 64 69 64 78 2c 20 28 63 |(write(f|didx, (c|
|00001690| 68 61 72 20 2a 29 26 6e | 65 77 6e 6f 64 65 2c 20 |har *)&n|ewnode, |
|000016a0| 73 69 7a 65 6f 66 28 6c | 6f 6e 67 29 20 29 20 3d |sizeof(l|ong) ) =|
|000016b0| 3d 20 45 52 52 29 0d 0a | 20 20 20 20 20 20 20 20 |= ERR)..| |
|000016c0| 20 20 20 20 63 6b 65 72 | 72 6f 72 28 2d 20 43 4b | cker|ror(- CK|
|000016d0| 5f 57 52 49 54 2c 20 22 | 33 38 22 29 3b 0d 0a 0d |_WRIT, "|38");...|
|000016e0| 0a 20 20 20 20 20 20 20 | 20 20 6c 6f 63 6b 75 6e |. | lockun|
|000016f0| 6c 6b 28 66 64 69 64 78 | 2c 20 70 6f 73 2c 20 62 |lk(fdidx|, pos, b|
|00001700| 74 63 70 2d 3e 62 74 69 | 64 78 6c 65 6e 2c 20 55 |tcp->bti|dxlen, U|
|00001710| 4e 4c 4f 43 4b 52 29 3b | 0d 0a 20 20 20 20 20 20 |NLOCKR);|.. |
|00001720| 7d 0d 0a 20 20 20 20 0d | 0a 20 20 20 20 20 20 6e |}.. .|. n|
|00001730| 6f 64 65 20 3d 20 70 6f | 70 74 6f 70 28 29 3b 20 |ode = po|ptop(); |
|00001740| 20 2f 2a 20 67 65 74 20 | 70 61 72 65 6e 74 20 6e | /* get |parent n|
|00001750| 6f 64 65 20 2a 2f 0d 0a | 20 20 20 20 0d 0a 20 20 |ode */..| .. |
|00001760| 20 20 20 20 69 66 20 28 | 6e 6f 64 65 20 3d 3d 20 | if (|node == |
|00001770| 30 4c 29 7b 20 20 20 20 | 20 2f 2a 20 74 68 65 6e |0L){ | /* then|
|00001780| 20 72 6f 6f 74 20 6e 6f | 64 65 20 68 61 73 20 6a | root no|de has j|
|00001790| 75 73 74 20 62 65 65 6e | 20 73 70 6c 69 74 20 2a |ust been| split *|
|000017a0| 2f 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 2f 2a |/.... | /*|
|000017b0| 20 4d 41 4b 45 20 41 20 | 4e 45 57 20 52 4f 4f 54 | MAKE A |NEW ROOT|
|000017c0| 20 4e 4f 44 45 20 46 4f | 52 20 54 48 45 20 54 57 | NODE FO|R THE TW|
|000017d0| 4f 20 4e 45 57 4c 59 20 | 53 50 4c 49 54 20 4e 4f |O NEWLY |SPLIT NO|
|000017e0| 44 45 53 20 2a 2f 0d 0a | 0d 0a 20 20 20 20 20 20 |DES */..|.. |
|000017f0| 20 20 20 2f 2a 20 70 69 | 63 6b 20 75 70 20 4c 41 | /* pi|ck up LA|
|00001800| 53 54 20 63 65 6c 6c 73 | 20 66 72 6f 6d 20 62 6f |ST cells| from bo|
|00001810| 74 68 20 6e 6f 64 65 73 | 20 2a 2f 0d 0a 20 20 20 |th nodes| */.. |
|00001820| 20 20 20 20 20 20 73 74 | 72 63 70 79 28 69 64 78 | st|rcpy(idx|
|00001830| 62 6c 6b 2d 3e 62 74 70 | 61 67 65 5b 30 5d 2e 73 |blk->btp|age[0].s|
|00001840| 6b 65 79 6e 6d 65 2c 0d | 0a 20 20 20 20 20 20 20 |keynme,.|. |
|00001850| 20 20 20 20 20 20 20 20 | 69 64 78 62 6c 6b 2d 3e | |idxblk->|
|00001860| 62 74 70 61 67 65 5b 69 | 64 78 62 6c 6b 2d 3e 63 |btpage[i|dxblk->c|
|00001870| 65 6c 6c 69 63 6e 74 20 | 2d 20 31 5d 2e 73 6b 65 |ellicnt |- 1].ske|
|00001880| 79 6e 6d 65 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |ynme);..| |
|00001890| 20 69 64 78 62 6c 6b 2d | 3e 62 74 70 61 67 65 5b | idxblk-|>btpage[|
|000018a0| 30 5d 2e 62 74 70 74 72 | 20 3d 20 72 6f 6f 74 70 |0].btptr| = rootp|
|000018b0| 74 72 3b 20 20 2f 2a 20 | 75 73 65 20 6f 6c 64 20 |tr; /* |use old |
|000018c0| 72 6f 6f 74 20 70 6f 69 | 6e 74 65 72 20 2a 2f 0d |root poi|nter */.|
|000018d0| 0a 20 20 20 20 20 20 20 | 20 20 73 74 72 63 70 79 |. | strcpy|
|000018e0| 28 69 64 78 62 6c 6b 2d | 3e 62 74 70 61 67 65 5b |(idxblk-|>btpage[|
|000018f0| 31 5d 2e 73 6b 65 79 6e | 6d 65 2c 0d 0a 20 20 20 |1].skeyn|me,.. |
|00001900| 20 20 20 20 20 20 20 20 | 20 20 20 20 6e 75 69 64 | | nuid|
|00001910| 78 62 6c 6b 2d 3e 62 74 | 70 61 67 65 5b 6e 75 69 |xblk->bt|page[nui|
|00001920| 64 78 62 6c 6b 2d 3e 63 | 65 6c 6c 69 63 6e 74 20 |dxblk->c|ellicnt |
|00001930| 2d 20 31 5d 2e 73 6b 65 | 79 6e 6d 65 29 3b 0d 0a |- 1].ske|ynme);..|
|00001940| 20 20 20 20 20 20 20 20 | 20 69 64 78 62 6c 6b 2d | | idxblk-|
|00001950| 3e 62 74 70 61 67 65 5b | 31 5d 2e 62 74 70 74 72 |>btpage[|1].btptr|
|00001960| 20 3d 20 6e 65 77 6e 6f | 64 65 3b 0d 0a 0d 0a 20 | = newno|de;.... |
|00001970| 20 20 20 20 20 20 20 20 | 69 64 78 62 6c 6b 2d 3e | |idxblk->|
|00001980| 66 77 64 70 61 67 65 20 | 3d 20 30 4c 3b 20 20 20 |fwdpage |= 0L; |
|00001990| 20 20 20 2f 2a 20 69 6e | 69 74 69 61 6c 69 7a 65 | /* in|itialize|
|000019a0| 20 72 6f 6f 74 20 6e 6f | 64 65 20 2a 2f 0d 0a 20 | root no|de */.. |
|000019b0| 20 20 20 20 20 20 20 20 | 69 64 78 62 6c 6b 2d 3e | |idxblk->|
|000019c0| 62 77 64 70 61 67 65 20 | 3d 20 30 4c 3b 0d 0a 20 |bwdpage |= 0L;.. |
|000019d0| 20 20 20 20 20 20 20 20 | 69 64 78 62 6c 6b 2d 3e | |idxblk->|
|000019e0| 63 65 6c 6c 69 63 6e 74 | 20 3d 20 32 3b 0d 0a 20 |cellicnt| = 2;.. |
|000019f0| 20 20 20 20 20 20 20 20 | 69 64 78 62 6c 6b 2d 3e | |idxblk->|
|00001a00| 62 6c 6b 74 79 70 65 20 | 3d 20 30 3b 0d 0a 0d 0a |blktype |= 0;....|
|00001a10| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 77 68 65 72 | | /* wher|
|00001a20| 65 20 74 6f 20 77 72 69 | 74 65 20 6e 65 77 20 72 |e to wri|te new r|
|00001a30| 6f 6f 74 20 70 6f 69 6e | 74 65 72 20 2a 2f 0d 0a |oot poin|ter */..|
|00001a40| 20 20 20 20 20 20 20 20 | 20 72 6f 6f 74 70 74 72 | | rootptr|
|00001a50| 20 3d 20 62 74 63 70 2d | 3e 62 74 72 6f 6f 74 20 | = btcp-|>btroot |
|00001a60| 3d 20 67 69 76 65 69 64 | 78 72 28 66 64 69 64 78 |= giveid|xr(fdidx|
|00001a70| 2c 20 62 74 63 70 2d 3e | 62 74 69 64 78 6c 65 6e |, btcp->|btidxlen|
|00001a80| 2c 20 31 2c 20 30 29 3b | 0d 0a 20 20 20 20 20 20 |, 1, 0);|.. |
|00001a90| 20 20 20 70 75 74 72 6f | 6f 74 28 66 64 69 64 78 | putro|ot(fdidx|
|00001aa0| 2c 20 72 6f 6f 74 70 74 | 72 2c 20 62 74 63 70 2d |, rootpt|r, btcp-|
|00001ab0| 3e 66 69 6e 64 72 6f 6f | 74 29 3b 20 20 2f 2a 20 |>findroo|t); /* |
|00001ac0| 73 74 6f 72 65 20 6e 65 | 77 20 72 6f 6f 74 20 61 |store ne|w root a|
|00001ad0| 64 64 72 20 2a 2f 0d 0a | 20 20 20 20 0d 0a 20 20 |ddr */..| .. |
|00001ae0| 20 20 20 20 20 20 20 6c | 6f 63 6b 6c 69 73 74 5b | l|ocklist[|
|00001af0| 6c 6f 63 6b 70 74 72 2b | 2b 5d 20 3d 20 28 72 6f |lockptr+|+] = (ro|
|00001b00| 6f 74 70 74 72 20 2d 20 | 31 4c 29 20 2a 20 62 74 |otptr - |1L) * bt|
|00001b10| 63 70 2d 3e 62 74 69 64 | 78 6c 65 6e 3b 0d 0a 20 |cp->btid|xlen;.. |
|00001b20| 20 20 20 20 20 20 20 20 | 70 75 74 69 64 78 72 28 | |putidxr(|
|00001b30| 66 64 69 64 78 2c 20 72 | 6f 6f 74 70 74 72 2c 20 |fdidx, r|ootptr, |
|00001b40| 69 64 78 62 6c 6b 2c 20 | 62 74 63 70 29 3b 0d 0a |idxblk, |btcp);..|
|00001b50| 20 20 20 0d 0a 20 20 20 | 20 20 20 20 20 20 62 72 | .. | br|
|00001b60| 65 61 6b 3b 20 20 20 20 | 20 20 2f 2a 20 61 6c 6c |eak; | /* all|
|00001b70| 20 64 6f 6e 65 20 2a 2f | 0d 0a 20 20 20 20 20 20 | done */|.. |
|00001b80| 7d 0d 0a 0d 0a 20 20 20 | 20 20 20 2f 2a 2a 2a 2a |}.... | /****|
|00001b90| 20 75 70 64 61 74 65 20 | 50 41 52 45 4e 54 20 6e | update |PARENT n|
|00001ba0| 6f 64 65 20 74 6f 20 72 | 65 66 6c 65 63 74 20 6e |ode to r|eflect n|
|00001bb0| 65 77 6c 79 20 73 70 6c | 69 74 20 63 68 69 6c 64 |ewly spl|it child|
|00001bc0| 72 65 6e 20 2a 2f 0d 0a | 20 20 20 0d 0a 20 20 20 |ren */..| .. |
|00001bd0| 20 20 20 67 65 74 69 64 | 78 72 28 66 64 69 64 78 | getid|xr(fdidx|
|00001be0| 2c 20 6e 6f 64 65 2c 20 | 69 64 78 62 6c 6b 2c 20 |, node, |idxblk, |
|00001bf0| 62 74 63 70 2d 3e 62 74 | 69 64 78 6c 65 6e 2c 20 |btcp->bt|idxlen, |
|00001c00| 62 74 63 70 2d 3e 62 74 | 6b 65 79 6c 65 6e 29 3b |btcp->bt|keylen);|
|00001c10| 0d 0a 20 20 20 0d 0a 20 | 20 20 20 20 20 2f 2a 20 |.. .. | /* |
|00001c20| 67 65 74 20 62 74 70 61 | 67 65 20 6f 66 66 73 65 |get btpa|ge offse|
|00001c30| 74 20 66 6f 72 20 70 6f | 73 69 74 69 6f 6e 20 6f |t for po|sition o|
|00001c40| 66 20 6b 65 79 20 2a 2f | 0d 0a 20 20 20 20 20 20 |f key */|.. |
|00001c50| 68 64 72 6c 6f 63 20 3d | 20 62 69 6e 61 72 79 73 |hdrloc =| binarys|
|00001c60| 72 28 69 64 78 62 6c 6b | 2c 20 6e 65 77 6b 65 79 |r(idxblk|, newkey|
|00001c70| 2c 20 73 74 72 6c 65 6e | 28 6e 65 77 6b 65 79 29 |, strlen|(newkey)|
|00001c80| 29 3b 0d 0a 20 20 20 0d | 0a 20 20 20 20 20 20 2f |);.. .|. /|
|00001c90| 2a 20 6e 6f 77 20 69 6e | 73 65 72 74 20 6e 65 77 |* now in|sert new|
|00001ca0| 20 6b 65 79 20 69 6e 74 | 6f 20 70 72 65 76 69 6f | key int|o previo|
|00001cb0| 75 73 20 6e 6f 64 65 20 | 20 20 20 2a 2f 0d 0a 20 |us node | */.. |
|00001cc0| 20 20 20 20 20 69 66 20 | 28 69 64 78 62 6c 6b 2d | if |(idxblk-|
|00001cd0| 3e 63 65 6c 6c 69 63 6e | 74 20 3c 20 62 74 63 70 |>cellicn|t < btcp|
|00001ce0| 2d 3e 62 74 63 65 6c 6c | 73 29 7b 20 20 20 2f 2a |->btcell|s){ /*|
|00001cf0| 20 77 65 20 68 61 76 65 | 20 72 6f 6f 6d 20 66 6f | we have| room fo|
|00001d00| 72 20 6e 65 77 20 6b 65 | 79 20 2a 2f 0d 0a 20 20 |r new ke|y */.. |
|00001d10| 20 0d 0a 20 20 20 20 20 | 20 20 20 20 69 6e 73 65 | .. | inse|
|00001d20| 72 74 6b 79 28 69 64 78 | 62 6c 6b 2c 20 68 64 72 |rtky(idx|blk, hdr|
|00001d30| 6c 6f 63 2c 20 6e 65 77 | 6b 65 79 2c 20 62 74 63 |loc, new|key, btc|
|00001d40| 70 2d 3e 62 74 6b 65 79 | 6c 65 6e 29 3b 0d 0a 20 |p->btkey|len);.. |
|00001d50| 20 20 20 20 20 20 20 20 | 69 64 78 62 6c 6b 2d 3e | |idxblk->|
|00001d60| 62 74 70 61 67 65 5b 68 | 64 72 6c 6f 63 20 2b 20 |btpage[h|drloc + |
|00001d70| 31 5d 2e 62 74 70 74 72 | 20 3d 20 6e 65 77 6e 6f |1].btptr| = newno|
|00001d80| 64 65 3b 20 20 20 20 20 | 2f 2a 20 73 65 74 20 6e |de; |/* set n|
|00001d90| 65 77 20 6e 6f 64 65 20 | 2a 2f 0d 0a 20 20 20 20 |ew node |*/.. |
|00001da0| 20 20 20 0d 0a 20 20 20 | 20 20 20 20 20 20 2f 2a | .. | /*|
|00001db0| 20 77 72 69 74 65 20 74 | 68 65 20 69 6e 64 65 78 | write t|he index|
|00001dc0| 20 72 65 63 6f 72 64 20 | 74 6f 20 64 69 73 6b 20 | record |to disk |
|00001dd0| 20 2a 2f 0d 0a 20 20 20 | 20 20 20 20 20 20 70 75 | */.. | pu|
|00001de0| 74 69 64 78 72 28 66 64 | 69 64 78 2c 20 6e 6f 64 |tidxr(fd|idx, nod|
|00001df0| 65 2c 20 69 64 78 62 6c | 6b 2c 20 62 74 63 70 29 |e, idxbl|k, btcp)|
|00001e00| 3b 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 62 72 |;.... | br|
|00001e10| 65 61 6b 3b 20 20 20 2f | 2a 20 77 65 20 64 6f 6e |eak; /|* we don|
|00001e20| 65 20 2a 2f 0d 0a 20 20 | 20 20 20 20 7d 0d 0a 20 |e */.. | }.. |
|00001e30| 20 20 0d 0a 20 20 20 20 | 20 20 2f 2a 2a 2a 2a 20 | .. | /**** |
|00001e40| 50 41 52 45 4e 54 20 4e | 4f 44 45 20 49 53 20 46 |PARENT N|ODE IS F|
|00001e50| 55 4c 4c 3a 20 6d 75 73 | 74 20 62 65 20 73 70 6c |ULL: mus|t be spl|
|00001e60| 69 74 20 2a 2a 2a 2a 2f | 0d 0a 0d 0a 20 20 20 20 |it ****/|.... |
|00001e70| 20 20 73 70 6c 69 74 70 | 74 20 3d 20 28 69 64 78 | splitp|t = (idx|
|00001e80| 62 6c 6b 2d 3e 63 65 6c | 6c 69 63 6e 74 20 2b 20 |blk->cel|licnt + |
|00001e90| 31 29 20 3e 3e 20 31 3b | 20 20 20 2f 2a 20 4c 43 |1) >> 1;| /* LC|
|00001ea0| 20 62 75 67 20 2a 2f 0d | 0a 20 20 20 20 20 20 69 | bug */.|. i|
|00001eb0| 66 20 28 69 64 78 62 6c | 6b 2d 3e 63 65 6c 6c 69 |f (idxbl|k->celli|
|00001ec0| 63 6e 74 20 26 20 31 29 | 20 20 20 20 2f 2a 20 63 |cnt & 1)| /* c|
|00001ed0| 65 6c 6c 20 63 6f 75 6e | 74 20 69 73 20 4f 44 44 |ell coun|t is ODD|
|00001ee0| 20 2a 2f 0d 0a 20 20 20 | 20 20 20 20 20 20 73 70 | */.. | sp|
|00001ef0| 6c 69 74 70 74 20 2d 3d | 20 28 68 64 72 6c 6f 63 |litpt -=| (hdrloc|
|00001f00| 20 3c 20 73 70 6c 69 74 | 70 74 29 3b 20 20 20 20 | < split|pt); |
|00001f10| 20 20 2f 2a 20 61 64 6a | 75 73 74 20 73 70 6c 69 | /* adj|ust spli|
|00001f20| 74 70 6f 69 6e 74 20 2a | 2f 0d 0a 0d 0a 20 20 20 |tpoint *|/.... |
|00001f30| 20 20 20 73 70 6c 74 6e | 6f 64 65 28 69 64 78 62 | spltn|ode(idxb|
|00001f40| 6c 6b 2c 20 6e 75 69 64 | 78 62 6c 6b 2c 20 73 70 |lk, nuid|xblk, sp|
|00001f50| 6c 69 74 70 74 29 3b 0d | 0a 20 20 20 0d 0a 20 20 |litpt);.|. .. |
|00001f60| 20 20 20 20 2f 2a 20 6e | 6f 77 20 69 6e 73 65 72 | /* n|ow inser|
|00001f70| 74 20 6e 65 77 20 6b 65 | 79 20 2a 2f 0d 0a 20 20 |t new ke|y */.. |
|00001f80| 20 20 20 20 69 66 28 68 | 64 72 6c 6f 63 20 3c 20 | if(h|drloc < |
|00001f90| 73 70 6c 69 74 70 74 29 | 20 7b 0d 0a 20 20 20 20 |splitpt)| {.. |
|00001fa0| 20 20 20 20 20 69 64 78 | 70 20 3d 20 69 64 78 62 | idx|p = idxb|
|00001fb0| 6c 6b 3b 0d 0a 20 20 20 | 20 20 20 20 20 20 68 6c |lk;.. | hl|
|00001fc0| 6f 63 20 3d 20 68 64 72 | 6c 6f 63 3b 0d 0a 20 20 |oc = hdr|loc;.. |
|00001fd0| 20 20 20 20 7d 0d 0a 20 | 20 20 20 20 20 65 6c 73 | }.. | els|
|00001fe0| 65 20 7b 0d 0a 20 20 20 | 20 20 20 20 20 20 69 64 |e {.. | id|
|00001ff0| 78 70 20 3d 20 6e 75 69 | 64 78 62 6c 6b 3b 0d 0a |xp = nui|dxblk;..|
|00002000| 20 20 20 20 20 20 20 20 | 20 68 6c 6f 63 20 3d 20 | | hloc = |
|00002010| 68 64 72 6c 6f 63 20 2d | 20 28 69 6e 74 29 73 70 |hdrloc -| (int)sp|
|00002020| 6c 69 74 70 74 3b 0d 0a | 20 20 20 20 20 20 7d 0d |litpt;..| }.|
|00002030| 0a 20 20 20 20 20 20 69 | 6e 73 65 72 74 6b 79 28 |. i|nsertky(|
|00002040| 69 64 78 70 2c 20 68 6c | 6f 63 2c 20 6e 65 77 6b |idxp, hl|oc, newk|
|00002050| 65 79 2c 20 62 74 63 70 | 2d 3e 62 74 6b 65 79 6c |ey, btcp|->btkeyl|
|00002060| 65 6e 29 3b 0d 0a 20 20 | 20 20 20 20 69 64 78 70 |en);.. | idxp|
|00002070| 2d 3e 62 74 70 61 67 65 | 5b 68 6c 6f 63 20 2b 20 |->btpage|[hloc + |
|00002080| 31 5d 2e 62 74 70 74 72 | 20 3d 20 6e 65 77 6e 6f |1].btptr| = newno|
|00002090| 64 65 3b 0d 0a 20 20 20 | 20 20 20 6e 75 69 64 78 |de;.. | nuidx|
|000020a0| 62 6c 6b 2d 3e 62 6c 6b | 74 79 70 65 20 3d 20 69 |blk->blk|type = i|
|000020b0| 64 78 62 6c 6b 2d 3e 62 | 6c 6b 74 79 70 65 3b 20 |dxblk->b|lktype; |
|000020c0| 20 20 2f 2a 20 62 6c 6b | 74 79 70 65 20 3d 20 30 | /* blk|type = 0|
|000020d0| 20 2a 2f 0d 0a 0d 0a 20 | 20 20 7d 20 20 2f 2a 20 | */.... | } /* |
|000020e0| 65 6e 64 20 66 6f 72 28 | 3b 3b 29 3a 20 67 6f 20 |end for(|;;): go |
|000020f0| 62 61 63 6b 20 61 6e 64 | 20 77 72 69 74 65 20 72 |back and| write r|
|00002100| 65 63 6f 72 64 20 2a 2f | 0d 0a 0d 0a 20 20 20 66 |ecord */|.... f|
|00002110| 72 65 65 6b 65 79 73 28 | 6e 75 69 64 78 62 6c 6b |reekeys(|nuidxblk|
|00002120| 29 3b 0d 0a 20 20 20 46 | 52 45 45 28 6e 75 69 64 |);.. F|REE(nuid|
|00002130| 78 62 6c 6b 29 3b 0d 0a | 20 20 20 46 52 45 45 28 |xblk);..| FREE(|
|00002140| 6e 65 77 6b 65 79 29 3b | 0d 0a 20 20 20 72 65 74 |newkey);|.. ret|
|00002150| 75 72 6e 28 42 54 43 41 | 4c 4c 4f 4b 29 3b 20 20 |urn(BTCA|LLOK); |
|00002160| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 66 69 6e 61 | | /* fina|
|00002170| 6c 6c 79 20 72 65 74 75 | 72 6e 20 74 6f 20 63 61 |lly retu|rn to ca|
|00002180| 6c 6c 69 6e 67 20 70 67 | 6d 2e 20 2a 2f 0d 0a 7d |lling pg|m. */..}|
|00002190| 0d 0a 0d 0a | |.... | |
+--------+-------------------------+-------------------------+--------+--------+