]> granicus.if.org Git - postgresql/commitdiff
Avoid use of inline functions that are not declared static. Needed to
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 31 Oct 2002 19:11:48 +0000 (19:11 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 31 Oct 2002 19:11:48 +0000 (19:11 +0000)
conform to C99's brain-dead notion of how inline functions should work.

contrib/dbase/dbf2pg.c
src/backend/utils/sort/tuplesort.c

index f8e6bafcd1b845e61b0a1ab7a91c26c533e2c880..abf04dfa28a1c9eb93d5f92b0c6db907afa05061 100644 (file)
@@ -49,9 +49,10 @@ char    *subarg = NULL;
 char           escape_buff[8192];
 
 void           do_substitute(char *subarg, dbhead * dbh);
-inline void strtoupper(char *string);
 
-inline void strtolower(char *string);
+static inline void strtoupper(char *string);
+static inline void strtolower(char *string);
+
 void           do_create(PGconn *, char *, dbhead *);
 void           do_inserts(PGconn *, char *, dbhead *);
 int                    check_table(PGconn *, char *);
@@ -88,7 +89,7 @@ isinteger(char *buff)
        return 1;
 }
 
-inline void
+static inline void
 strtoupper(char *string)
 {
        while (*string != '\0')
@@ -98,7 +99,7 @@ strtoupper(char *string)
        }
 }
 
-inline void
+static inline void
 strtolower(char *string)
 {
        while (*string != '\0')
index 38e73f8a63e722db7ac59b6d9708717df017a713..164e16b1dda4f75d9a1c29df20004ae0a2575628 100644 (file)
@@ -78,7 +78,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.28 2002/10/04 17:19:55 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.29 2002/10/31 19:11:48 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1835,10 +1835,10 @@ myFunctionCall2(FmgrInfo *flinfo, Datum arg1, Datum arg2)
  * and return a 3-way comparison result.  This takes care of handling
  * NULLs and sort ordering direction properly.
  */
-inline int32
-ApplySortFunction(FmgrInfo *sortFunction, SortFunctionKind kind,
-                                 Datum datum1, bool isNull1,
-                                 Datum datum2, bool isNull2)
+static inline int32
+inlineApplySortFunction(FmgrInfo *sortFunction, SortFunctionKind kind,
+                                               Datum datum1, bool isNull1,
+                                               Datum datum2, bool isNull2)
 {
        switch (kind)
        {
@@ -1903,6 +1903,20 @@ ApplySortFunction(FmgrInfo *sortFunction, SortFunctionKind kind,
        }
 }
 
+/*
+ * Non-inline ApplySortFunction() --- this is needed only to conform to
+ * C99's brain-dead notions about how to implement inline functions...
+ */
+int32
+ApplySortFunction(FmgrInfo *sortFunction, SortFunctionKind kind,
+                                 Datum datum1, bool isNull1,
+                                 Datum datum2, bool isNull2)
+{
+       return inlineApplySortFunction(sortFunction, kind,
+                                                                  datum1, isNull1,
+                                                                  datum2, isNull2);
+}
+
 
 /*
  * Routines specialized for HeapTuple case
@@ -1929,9 +1943,10 @@ comparetup_heap(Tuplesortstate *state, const void *a, const void *b)
                datum1 = heap_getattr(ltup, attno, tupDesc, &isnull1);
                datum2 = heap_getattr(rtup, attno, tupDesc, &isnull2);
 
-               compare = ApplySortFunction(&scanKey->sk_func,
-                                                                       state->sortFnKinds[nkey],
-                                                                       datum1, isnull1, datum2, isnull2);
+               compare = inlineApplySortFunction(&scanKey->sk_func,
+                                                                                 state->sortFnKinds[nkey],
+                                                                                 datum1, isnull1,
+                                                                                 datum2, isnull2);
                if (compare != 0)
                {
                        /* 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)
                /* see comments about NULLs handling in btbuild */
 
                /* the comparison function is always of CMP type */
-               compare = ApplySortFunction(&entry->sk_func, SORTFUNC_CMP,
-                                                                       datum1, isnull1, datum2, isnull2);
+               compare = inlineApplySortFunction(&entry->sk_func, SORTFUNC_CMP,
+                                                                                 datum1, isnull1,
+                                                                                 datum2, isnull2);
 
                if (compare != 0)
                        return (int) compare;           /* done when we find unequal
@@ -2137,9 +2153,9 @@ comparetup_datum(Tuplesortstate *state, const void *a, const void *b)
        DatumTuple *ltup = (DatumTuple *) a;
        DatumTuple *rtup = (DatumTuple *) b;
 
-       return ApplySortFunction(&state->sortOpFn, state->sortFnKind,
-                                                        ltup->val, ltup->isNull,
-                                                        rtup->val, rtup->isNull);
+       return inlineApplySortFunction(&state->sortOpFn, state->sortFnKind,
+                                                                  ltup->val, ltup->isNull,
+                                                                  rtup->val, rtup->isNull);
 }
 
 static void *