78
78
* Portions Copyright (c) 1994, Regents of the University of California
79
79
*
80
80
* IDENTIFICATION
81
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.28 2002/10/04 17: 19:55 tgl Exp $
81
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.29 2002/10/31 19:11:48 tgl Exp $
82
82
*
83
83
*-------------------------------------------------------------------------
84
84
*/
@@ -1835,10 +1835,10 @@ myFunctionCall2(FmgrInfo *flinfo, Datum arg1, Datum arg2)
1835
1835
* and return a 3-way comparison result. This takes care of handling
1836
1836
* NULLs and sort ordering direction properly.
1837
1837
*/
1838
- inline int32
1839
- ApplySortFunction (FmgrInfo * sortFunction , SortFunctionKind kind ,
1840
- Datum datum1 , bool isNull1 ,
1841
- Datum datum2 , bool isNull2 )
1838
+ static inline int32
1839
+ inlineApplySortFunction (FmgrInfo * sortFunction , SortFunctionKind kind ,
1840
+ Datum datum1 , bool isNull1 ,
1841
+ Datum datum2 , bool isNull2 )
1842
1842
{
1843
1843
switch (kind )
1844
1844
{
@@ -1903,6 +1903,20 @@ ApplySortFunction(FmgrInfo *sortFunction, SortFunctionKind kind,
1903
1903
}
1904
1904
}
1905
1905
1906
+ /*
1907
+ * Non-inline ApplySortFunction() --- this is needed only to conform to
1908
+ * C99's brain-dead notions about how to implement inline functions...
1909
+ */
1910
+ int32
1911
+ ApplySortFunction (FmgrInfo * sortFunction , SortFunctionKind kind ,
1912
+ Datum datum1 , bool isNull1 ,
1913
+ Datum datum2 , bool isNull2 )
1914
+ {
1915
+ return inlineApplySortFunction (sortFunction , kind ,
1916
+ datum1 , isNull1 ,
1917
+ datum2 , isNull2 );
1918
+ }
1919
+
1906
1920
1907
1921
/*
1908
1922
* Routines specialized for HeapTuple case
@@ -1929,9 +1943,10 @@ comparetup_heap(Tuplesortstate *state, const void *a, const void *b)
1929
1943
datum1 = heap_getattr (ltup , attno , tupDesc , & isnull1 );
1930
1944
datum2 = heap_getattr (rtup , attno , tupDesc , & isnull2 );
1931
1945
1932
- compare = ApplySortFunction (& scanKey -> sk_func ,
1933
- state -> sortFnKinds [nkey ],
1934
- datum1 , isnull1 , datum2 , isnull2 );
1946
+ compare = inlineApplySortFunction (& scanKey -> sk_func ,
1947
+ state -> sortFnKinds [nkey ],
1948
+ datum1 , isnull1 ,
1949
+ datum2 , isnull2 );
1935
1950
if (compare != 0 )
1936
1951
{
1937
1952
/* dead code? SK_COMMUTE can't actually be set here, can it? */
@@ -2043,8 +2058,9 @@ comparetup_index(Tuplesortstate *state, const void *a, const void *b)
2043
2058
/* see comments about NULLs handling in btbuild */
2044
2059
2045
2060
/* the comparison function is always of CMP type */
2046
- compare = ApplySortFunction (& entry -> sk_func , SORTFUNC_CMP ,
2047
- datum1 , isnull1 , datum2 , isnull2 );
2061
+ compare = inlineApplySortFunction (& entry -> sk_func , SORTFUNC_CMP ,
2062
+ datum1 , isnull1 ,
2063
+ datum2 , isnull2 );
2048
2064
2049
2065
if (compare != 0 )
2050
2066
return (int ) compare ; /* done when we find unequal
@@ -2137,9 +2153,9 @@ comparetup_datum(Tuplesortstate *state, const void *a, const void *b)
2137
2153
DatumTuple * ltup = (DatumTuple * ) a ;
2138
2154
DatumTuple * rtup = (DatumTuple * ) b ;
2139
2155
2140
- return ApplySortFunction (& state -> sortOpFn , state -> sortFnKind ,
2141
- ltup -> val , ltup -> isNull ,
2142
- rtup -> val , rtup -> isNull );
2156
+ return inlineApplySortFunction (& state -> sortOpFn , state -> sortFnKind ,
2157
+ ltup -> val , ltup -> isNull ,
2158
+ rtup -> val , rtup -> isNull );
2143
2159
}
2144
2160
2145
2161
static void *
0 commit comments