mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 10:30:33 +03:00 
			
		
		
		
	Remove Item type
This type is just char * underneath, it provides no real value, no type safety, and just makes the code one level more mysterious. It is more idiomatic to refer to blobs of memory by a combination of void * and size_t, so change it to that. Also, since this type hides the pointerness, we can't apply qualifiers to what is pointed to, which requires some unconstify nonsense. This change allows fixing that. Extension code that uses the Item type can change its code to use void * to be backward compatible. Reviewed-by: Nathan Bossart <nathandbossart@gmail.com> Reviewed-by: Peter Geoghegan <pg@bowt.ie> Discussion: https://www.postgresql.org/message-id/flat/c75cccf5-5709-407b-a36a-2ae6570be766@eisentraut.org
This commit is contained in:
		| @@ -404,8 +404,7 @@ fill_seq_fork_with_data(Relation rel, HeapTuple tuple, ForkNumber forkNum) | ||||
|  | ||||
| 	MarkBufferDirty(buf); | ||||
|  | ||||
| 	offnum = PageAddItem(page, (Item) tuple->t_data, tuple->t_len, | ||||
| 						 InvalidOffsetNumber, false, false); | ||||
| 	offnum = PageAddItem(page, tuple->t_data, tuple->t_len, InvalidOffsetNumber, false, false); | ||||
| 	if (offnum != FirstOffsetNumber) | ||||
| 		elog(ERROR, "failed to add sequence tuple to page"); | ||||
|  | ||||
| @@ -1946,8 +1945,7 @@ seq_redo(XLogReaderState *record) | ||||
| 	item = (char *) xlrec + sizeof(xl_seq_rec); | ||||
| 	itemsz = XLogRecGetDataLen(record) - sizeof(xl_seq_rec); | ||||
|  | ||||
| 	if (PageAddItem(localpage, (Item) item, itemsz, | ||||
| 					FirstOffsetNumber, false, false) == InvalidOffsetNumber) | ||||
| 	if (PageAddItem(localpage, item, itemsz, FirstOffsetNumber, false, false) == InvalidOffsetNumber) | ||||
| 		elog(PANIC, "seq_redo: failed to add item to page"); | ||||
|  | ||||
| 	PageSetLSN(localpage, lsn); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user