]> granicus.if.org Git - postgresql/commitdiff
Fix memory overhelding while forming index' result:
authorVadim B. Mikheev <vadim4o@yahoo.com>
Thu, 21 Nov 1996 06:06:52 +0000 (06:06 +0000)
committerVadim B. Mikheev <vadim4o@yahoo.com>
Thu, 21 Nov 1996 06:06:52 +0000 (06:06 +0000)
memory allocation for ItemPointerData of heap' tuple is useless

because of FormRetrieveIndexResult makes neccessary palloc.

src/backend/access/hash/hashsearch.c

index 654e04be592139fb709513313f900ab76588f366..459fbc3a167984af787857026091706a3d777256 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.7 1996/11/05 09:40:23 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.8 1996/11/21 06:06:52 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -74,7 +74,6 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
     OffsetNumber offnum;
     RetrieveIndexResult res;
     ItemPointer current;
-    ItemPointer iptr;
     HashItem hitem;
     IndexTuple itup;
     HashScanOpaque so;
@@ -116,9 +115,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
     _hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
     hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
     itup = &hitem->hash_itup;
-    iptr = (ItemPointer) palloc(sizeof(ItemPointerData));
-    memmove((char *) iptr, (char *) &(itup->t_tid),  sizeof(ItemPointerData));
-    res = FormRetrieveIndexResult(current, iptr);
+    res = FormRetrieveIndexResult(current, &(itup->t_tid));
 
     return (res);
 }
@@ -184,7 +181,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
     HashItem hitem;
     IndexTuple itup;
     ItemPointer current;
-    ItemPointer iptr;
     OffsetNumber offnum;
     RetrieveIndexResult res;
     HashScanOpaque so;
@@ -245,9 +241,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
     _hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
     hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
     itup = &hitem->hash_itup;
-    iptr = (ItemPointer) palloc(sizeof(ItemPointerData));
-    memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData));
-    res = FormRetrieveIndexResult(current, iptr);
+    res = FormRetrieveIndexResult(current, &(itup->t_tid));
 
     return (res);
 }