mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Add support for easily declaring static inline functions
We already had those, but they forced modules to spell out the function bodies twice. Eliminate some duplicates we had already grown. Extracted from a somewhat larger patch from Andres Freund.
This commit is contained in:
		@@ -101,14 +101,21 @@ typedef struct SortSupportData
 | 
			
		||||
} SortSupportData;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* ApplySortComparator should be inlined if possible */
 | 
			
		||||
#ifdef USE_INLINE
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ApplySortComparator should be inlined if possible.  See STATIC_IF_INLINE
 | 
			
		||||
 * in c.h.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef USE_INLINE
 | 
			
		||||
extern int ApplySortComparator(Datum datum1, bool isNull1,
 | 
			
		||||
					Datum datum2, bool isNull2,
 | 
			
		||||
					SortSupport ssup);
 | 
			
		||||
#endif   /* !USE_INLINE */
 | 
			
		||||
#if defined(USE_INLINE) || defined(SORTSUPPORT_INCLUDE_DEFINITIONS)
 | 
			
		||||
/*
 | 
			
		||||
 * Apply a sort comparator function and return a 3-way comparison result.
 | 
			
		||||
 * This takes care of handling reverse-sort and NULLs-ordering properly.
 | 
			
		||||
 */
 | 
			
		||||
static inline int
 | 
			
		||||
STATIC_IF_INLINE int
 | 
			
		||||
ApplySortComparator(Datum datum1, bool isNull1,
 | 
			
		||||
					Datum datum2, bool isNull2,
 | 
			
		||||
					SortSupport ssup)
 | 
			
		||||
@@ -140,12 +147,7 @@ ApplySortComparator(Datum datum1, bool isNull1,
 | 
			
		||||
 | 
			
		||||
	return compare;
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
extern int ApplySortComparator(Datum datum1, bool isNull1,
 | 
			
		||||
					Datum datum2, bool isNull2,
 | 
			
		||||
					SortSupport ssup);
 | 
			
		||||
#endif   /* USE_INLINE */
 | 
			
		||||
#endif	/* USE_INLINE || SORTSUPPORT_INCLUDE_DEFINITIONS */
 | 
			
		||||
 | 
			
		||||
/* Other functions in utils/sort/sortsupport.c */
 | 
			
		||||
extern void PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user