move row stamp business to its own file
authorMarko Kreen <markokr@gmail.com>
Wed, 28 Mar 2007 17:35:25 +0000 (17:35 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 28 Mar 2007 17:35:25 +0000 (17:35 +0000)
Makefile
src/plproxy.h
src/rowstamp.h [new file with mode: 0644]

index 303103af15d04c9994e9ade8fe7722f21f97e837..e2f1ab8a12745925e88fc7c5bf1a65c476f5a533 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ gen:
        cd src; flex -o scanner.c scanner.l
 
 # dependencies
-$(OBJS): src/plproxy.h
+$(OBJS): src/plproxy.h src/rowstamp.h
 
 # utility rules
 
index 75ef7306d83c73182b1efe3527861cb7beea5adc..34f1a671527c90efbb5d4d788f147cf69f3fb925 100644 (file)
 /* for standard_conforming_strings */
 #include <parser/gramparse.h>
 
-#include <libpq-fe.h>
-
-#if PG_VERSION_NUM < 80300
-
-/*
- * Row version check for 8.2
- */
-typedef struct RowStamp {
-       TransactionId   xmin;
-       CommandId               cmin;
-} RowStamp;
-
-static inline void plproxy_set_stamp(RowStamp *stamp, HeapTuple tup)
-{
-       stamp->xmin = HeapTupleHeaderGetXmin(tup->t_data);
-       stamp->cmin = HeapTupleHeaderGetCmin(tup->t_data);
-}
-
-static inline bool plproxy_check_stamp(RowStamp *stamp, HeapTuple tup)
-{
-       return stamp->xmin == HeapTupleHeaderGetXmin(tup->t_data)
-               && stamp->cmin == HeapTupleHeaderGetCmin(tup->t_data);
-}
+#include "rowstamp.h"
 
-#else /* ver >= 8.3 */
-
-/*
- * Row version check for PG >= 8.3
- */
-typedef struct RowStamp {
-       TransactionId           xmin;
-       ItemPointerData         tid;
-} RowStamp;
-
-static inline void plproxy_set_stamp(RowStamp *stamp, HeapTuple tup)
-{
-       stamp->xmin = HeapTupleHeaderGetXmin(tup->t_data);
-       stamp->tid = tup->t_self;
-}
+#include <libpq-fe.h>
 
-static inline bool plproxy_check_stamp(RowStamp *stamp, HeapTuple tup)
-{
-       return stamp->xmin == HeapTupleHeaderGetXmin(tup->t_data)
-               && ItemPointerEquals(&stamp->tid, &tup->t_self);
-}
-#endif
 
 /*
  * Maintenece period in seconds.  Connnections will be freed
diff --git a/src/rowstamp.h b/src/rowstamp.h
new file mode 100644 (file)
index 0000000..acd51b2
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Row version check changed in 8.3
+ */
+
+#if PG_VERSION_NUM < 80300
+
+/*
+ * Row version check for 8.2
+ */
+typedef struct RowStamp {
+       TransactionId   xmin;
+       CommandId               cmin;
+} RowStamp;
+
+static inline void plproxy_set_stamp(RowStamp *stamp, HeapTuple tup)
+{
+       stamp->xmin = HeapTupleHeaderGetXmin(tup->t_data);
+       stamp->cmin = HeapTupleHeaderGetCmin(tup->t_data);
+}
+
+static inline bool plproxy_check_stamp(RowStamp *stamp, HeapTuple tup)
+{
+       return stamp->xmin == HeapTupleHeaderGetXmin(tup->t_data)
+               && stamp->cmin == HeapTupleHeaderGetCmin(tup->t_data);
+}
+
+#else /* ver >= 8.3 */
+
+/*
+ * Row version check for PG >= 8.3
+ */
+typedef struct RowStamp {
+       TransactionId           xmin;
+       ItemPointerData         tid;
+} RowStamp;
+
+static inline void plproxy_set_stamp(RowStamp *stamp, HeapTuple tup)
+{
+       stamp->xmin = HeapTupleHeaderGetXmin(tup->t_data);
+       stamp->tid = tup->t_self;
+}
+
+static inline bool plproxy_check_stamp(RowStamp *stamp, HeapTuple tup)
+{
+       return stamp->xmin == HeapTupleHeaderGetXmin(tup->t_data)
+               && ItemPointerEquals(&stamp->tid, &tup->t_self);
+}
+
+#endif
+