| | @@ -117,11 +117,11 @@ |
| 117 | 117 | |
| 118 | 118 | /* |
| 119 | 119 | ** Return the srcid associated with rid. Or return 0 if rid is |
| 120 | 120 | ** original content and not a delta. |
| 121 | 121 | */ |
| 122 | | -static int findSrcid(int rid){ |
| 122 | +int delta_source_rid(int rid){ |
| 123 | 123 | static Stmt q; |
| 124 | 124 | int srcid; |
| 125 | 125 | db_static_prepare(&q, "SELECT srcid FROM delta WHERE rid=:rid"); |
| 126 | 126 | db_bind_int(&q, ":rid", rid); |
| 127 | 127 | if( db_step(&q)==SQLITE_ROW ){ |
| | @@ -165,11 +165,11 @@ |
| 165 | 165 | } |
| 166 | 166 | if( content_size(rid, -1)<0 ){ |
| 167 | 167 | bag_insert(&contentCache.missing, rid); |
| 168 | 168 | return 0; |
| 169 | 169 | } |
| 170 | | - srcid = findSrcid(rid); |
| 170 | + srcid = delta_source_rid(rid); |
| 171 | 171 | if( srcid==0 ){ |
| 172 | 172 | bag_insert(&contentCache.available, rid); |
| 173 | 173 | return 1; |
| 174 | 174 | } |
| 175 | 175 | rid = srcid; |
| | @@ -250,11 +250,11 @@ |
| 250 | 250 | return 1; |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | | - nextRid = findSrcid(rid); |
| 255 | + nextRid = delta_source_rid(rid); |
| 256 | 256 | if( nextRid==0 ){ |
| 257 | 257 | rc = content_of_blob(rid, pBlob); |
| 258 | 258 | }else{ |
| 259 | 259 | int n = 1; |
| 260 | 260 | int nAlloc = 10; |
| | @@ -265,11 +265,11 @@ |
| 265 | 265 | a = fossil_malloc( sizeof(a[0])*nAlloc ); |
| 266 | 266 | a[0] = rid; |
| 267 | 267 | a[1] = nextRid; |
| 268 | 268 | n = 1; |
| 269 | 269 | while( !bag_find(&contentCache.inCache, nextRid) |
| 270 | | - && (nextRid = findSrcid(nextRid))>0 ){ |
| 270 | + && (nextRid = delta_source_rid(nextRid))>0 ){ |
| 271 | 271 | n++; |
| 272 | 272 | if( n>=nAlloc ){ |
| 273 | 273 | if( n>db_int(0, "SELECT max(rid) FROM blob") ){ |
| 274 | 274 | fossil_panic("infinite loop in DELTA table"); |
| 275 | 275 | } |
| | @@ -715,11 +715,11 @@ |
| 715 | 715 | /* |
| 716 | 716 | ** Make sure the content at rid is the original content and is not a |
| 717 | 717 | ** delta. |
| 718 | 718 | */ |
| 719 | 719 | void content_undelta(int rid){ |
| 720 | | - if( findSrcid(rid)>0 ){ |
| 720 | + if( delta_source_rid(rid)>0 ){ |
| 721 | 721 | Blob x; |
| 722 | 722 | if( content_get(rid, &x) ){ |
| 723 | 723 | Stmt s; |
| 724 | 724 | db_prepare(&s, "UPDATE blob SET content=:c, size=%d WHERE rid=%d", |
| 725 | 725 | blob_size(&x), rid); |
| | @@ -809,11 +809,11 @@ |
| 809 | 809 | int i; /* Loop variable for aSrc[] */ |
| 810 | 810 | |
| 811 | 811 | /* If rid is already a child (a delta) of some other artifact, return |
| 812 | 812 | ** immediately if the force flags is false |
| 813 | 813 | */ |
| 814 | | - if( !force && findSrcid(rid)>0 ) return 0; |
| 814 | + if( !force && delta_source_rid(rid)>0 ) return 0; |
| 815 | 815 | |
| 816 | 816 | /* Get the complete content of the object to be delta-ed. If the size |
| 817 | 817 | ** is less than 50 bytes, then there really is no point in trying to do |
| 818 | 818 | ** a delta, so return immediately |
| 819 | 819 | */ |
| | @@ -833,11 +833,11 @@ |
| 833 | 833 | |
| 834 | 834 | /* Compute all ancestors of srcid and make sure rid is not one of them. |
| 835 | 835 | ** If rid is an ancestor of srcid, then making rid a decendent of srcid |
| 836 | 836 | ** would create a delta loop. */ |
| 837 | 837 | s = srcid; |
| 838 | | - while( (s = findSrcid(s))>0 ){ |
| 838 | + while( (s = delta_source_rid(s))>0 ){ |
| 839 | 839 | if( s==rid ){ |
| 840 | 840 | content_undelta(srcid); |
| 841 | 841 | break; |
| 842 | 842 | } |
| 843 | 843 | } |
| 844 | 844 | |