mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-29 22:49:41 +03:00 
			
		
		
		
	Get rid of VARATT_SIZE and VARATT_DATA, which were simply redundant with VARSIZE and VARDATA, and as a consequence almost no code was using the longer names. Rename the length fields of struct varlena and various derived structures to catch anyplace that was accessing them directly; and clean up various places so caught. In itself this patch doesn't change any behavior at all, but it is necessary infrastructure if we hope to play any games with the representation of varlena headers. Greg Stark and Tom Lane
		
			
				
	
	
		
			35 lines
		
	
	
		
			844 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			844 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef __TXTIDX_STAT_H__
 | |
| #define __TXTIDX_STAT_H__
 | |
| 
 | |
| #include "postgres.h"
 | |
| 
 | |
| #include "access/gist.h"
 | |
| #include "access/itup.h"
 | |
| #include "utils/builtins.h"
 | |
| #include "storage/bufpage.h"
 | |
| #include "tsvector.h"
 | |
| 
 | |
| typedef struct
 | |
| {
 | |
| 	uint32		len;
 | |
| 	uint32		pos;
 | |
| 	uint32		ndoc;
 | |
| 	uint32		nentry;
 | |
| }	StatEntry;
 | |
| 
 | |
| typedef struct
 | |
| {
 | |
| 	int32		vl_len_;		/* varlena header (do not touch directly!) */
 | |
| 	int4		size;
 | |
| 	int4		weight;
 | |
| 	char		data[1];
 | |
| }	tsstat;
 | |
| 
 | |
| #define STATHDRSIZE (sizeof(int4) * 4)
 | |
| #define CALCSTATSIZE(x, lenstr) ( (x) * sizeof(StatEntry) + STATHDRSIZE + (lenstr) )
 | |
| #define STATPTR(x)	( (StatEntry*) ( (char*)(x) + STATHDRSIZE ) )
 | |
| #define STATSTRPTR(x)	( (char*)(x) + STATHDRSIZE + ( sizeof(StatEntry) * ((tsvector*)(x))->size ) )
 | |
| #define STATSTRSIZE(x)	( VARSIZE((tsvector*)(x)) - STATHDRSIZE - ( sizeof(StatEntry) * ((tsvector*)(x))->size ) )
 | |
| 
 | |
| #endif
 |