|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.80 2008/07/13 21:50:04 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.81 2008/11/03 20:47:48 tgl Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -254,28 +254,59 @@ PageAddItem(Page page, |
254 | 254 |
|
255 | 255 | /* |
256 | 256 | * PageGetTempPage |
257 | | - *Get a temporary page in local memory for special processing |
| 257 | + *Get a temporary page in local memory for special processing. |
| 258 | + *The returned page is not initialized at all; caller must do that. |
258 | 259 | */ |
259 | 260 | Page |
260 | | -PageGetTempPage(Pagepage,SizespecialSize) |
| 261 | +PageGetTempPage(Pagepage) |
| 262 | +{ |
| 263 | +SizepageSize; |
| 264 | +Pagetemp; |
| 265 | + |
| 266 | +pageSize=PageGetPageSize(page); |
| 267 | +temp= (Page)palloc(pageSize); |
| 268 | + |
| 269 | +returntemp; |
| 270 | +} |
| 271 | + |
| 272 | +/* |
| 273 | + * PageGetTempPageCopy |
| 274 | + *Get a temporary page in local memory for special processing. |
| 275 | + *The page is initialized by copying the contents of the given page. |
| 276 | + */ |
| 277 | +Page |
| 278 | +PageGetTempPageCopy(Pagepage) |
261 | 279 | { |
262 | 280 | SizepageSize; |
263 | 281 | Pagetemp; |
264 | | -PageHeaderthdr; |
265 | 282 |
|
266 | 283 | pageSize=PageGetPageSize(page); |
267 | 284 | temp= (Page)palloc(pageSize); |
268 | | -thdr= (PageHeader)temp; |
269 | 285 |
|
270 | | -/* copy old page in */ |
271 | 286 | memcpy(temp,page,pageSize); |
272 | 287 |
|
273 | | -/* set high, low water marks */ |
274 | | -thdr->pd_lower=SizeOfPageHeaderData; |
275 | | -thdr->pd_upper=pageSize-MAXALIGN(specialSize); |
| 288 | +returntemp; |
| 289 | +} |
| 290 | + |
| 291 | +/* |
| 292 | + * PageGetTempPageCopySpecial |
| 293 | + *Get a temporary page in local memory for special processing. |
| 294 | + *The page is PageInit'd with the same special-space size as the |
| 295 | + *given page, and the special space is copied from the given page. |
| 296 | + */ |
| 297 | +Page |
| 298 | +PageGetTempPageCopySpecial(Pagepage) |
| 299 | +{ |
| 300 | +SizepageSize; |
| 301 | +Pagetemp; |
| 302 | + |
| 303 | +pageSize=PageGetPageSize(page); |
| 304 | +temp= (Page)palloc(pageSize); |
276 | 305 |
|
277 | | -/* clear out the middle */ |
278 | | -MemSet((char*)temp+thdr->pd_lower,0,thdr->pd_upper-thdr->pd_lower); |
| 306 | +PageInit(temp,pageSize,PageGetSpecialSize(page)); |
| 307 | +memcpy(PageGetSpecialPointer(temp), |
| 308 | +PageGetSpecialPointer(page), |
| 309 | +PageGetSpecialSize(page)); |
279 | 310 |
|
280 | 311 | returntemp; |
281 | 312 | } |
|