Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5936055

Browse files
committed
Avoid use of inline functions that are not declared static. Needed to
conform to C99's brain-dead notion of how inline functions should work.
1 parent 2982b97 commit 5936055

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

contrib/dbase/dbf2pg.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ char *subarg = NULL;
4949
char escape_buff[8192];
5050

5151
void do_substitute(char *subarg, dbhead * dbh);
52-
inline void strtoupper(char *string);
5352

54-
inline void strtolower(char *string);
53+
static inline void strtoupper(char *string);
54+
static inline void strtolower(char *string);
55+
5556
void do_create(PGconn *, char *, dbhead *);
5657
void do_inserts(PGconn *, char *, dbhead *);
5758
int check_table(PGconn *, char *);
@@ -88,7 +89,7 @@ isinteger(char *buff)
8889
return 1;
8990
}
9091

91-
inline void
92+
static inline void
9293
strtoupper(char *string)
9394
{
9495
while (*string != '\0')
@@ -98,7 +99,7 @@ strtoupper(char *string)
9899
}
99100
}
100101

101-
inline void
102+
static inline void
102103
strtolower(char *string)
103104
{
104105
while (*string != '\0')

src/backend/utils/sort/tuplesort.c

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
* Portions Copyright (c) 1994, Regents of the University of California
7979
*
8080
* 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 $
8282
*
8383
*-------------------------------------------------------------------------
8484
*/
@@ -1835,10 +1835,10 @@ myFunctionCall2(FmgrInfo *flinfo, Datum arg1, Datum arg2)
18351835
* and return a 3-way comparison result. This takes care of handling
18361836
* NULLs and sort ordering direction properly.
18371837
*/
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)
18421842
{
18431843
switch (kind)
18441844
{
@@ -1903,6 +1903,20 @@ ApplySortFunction(FmgrInfo *sortFunction, SortFunctionKind kind,
19031903
}
19041904
}
19051905

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+
19061920

19071921
/*
19081922
* Routines specialized for HeapTuple case
@@ -1929,9 +1943,10 @@ comparetup_heap(Tuplesortstate *state, const void *a, const void *b)
19291943
datum1 = heap_getattr(ltup, attno, tupDesc, &isnull1);
19301944
datum2 = heap_getattr(rtup, attno, tupDesc, &isnull2);
19311945

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);
19351950
if (compare != 0)
19361951
{
19371952
/* 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)
20432058
/* see comments about NULLs handling in btbuild */
20442059

20452060
/* 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);
20482064

20492065
if (compare != 0)
20502066
return (int) compare; /* done when we find unequal
@@ -2137,9 +2153,9 @@ comparetup_datum(Tuplesortstate *state, const void *a, const void *b)
21372153
DatumTuple *ltup = (DatumTuple *) a;
21382154
DatumTuple *rtup = (DatumTuple *) b;
21392155

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);
21432159
}
21442160

21452161
static void *

0 commit comments

Comments
 (0)