Move pgproto header files to "include/pgproto".
authorBo Peng <pengbo@sraoss.co.jp>
Mon, 20 Aug 2018 08:04:45 +0000 (17:04 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Mon, 20 Aug 2018 08:04:45 +0000 (17:04 +0900)
14 files changed:
src/include/Makefile.am
src/include/Makefile.in
src/tools/pgproto/buffer.c
src/tools/pgproto/buffer.h [deleted file]
src/tools/pgproto/extended_query.c
src/tools/pgproto/extended_query.h [deleted file]
src/tools/pgproto/fe_memutils.c
src/tools/pgproto/fe_memutils.h [deleted file]
src/tools/pgproto/main.c
src/tools/pgproto/pgproto.h [deleted file]
src/tools/pgproto/read.c
src/tools/pgproto/read.h [deleted file]
src/tools/pgproto/send.c
src/tools/pgproto/send.h [deleted file]

index a140e41785b9727d779edba2b26b34049e3bc8fc..c2e47e41c97bf6662a8c7600144023853f3579c4 100644 (file)
@@ -5,4 +5,4 @@ DEFS = @DEFS@ \
 
 EXTRA_DIST = auth \
        context query_cache\
-       parser  pool.h  pcp  pool_type.h pool_config.h  protocol  rewrite  version.h  utils  watchdog  config.h  config.h.in  pool_config_variables.h
+       parser  pool.h  pcp  pool_type.h pool_config.h  protocol  rewrite  version.h  utils  watchdog  config.h  config.h.in  pool_config_variables.h pgproto
index 6c22d56fea870a1243fb58624329ff72be4ddb33..e2e1b646ca7ef5daf448ce6cc4d6fd5bdd1c3ed3 100644 (file)
@@ -279,7 +279,7 @@ top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I m4
 EXTRA_DIST = auth \
        context query_cache\
-       parser  pool.h  pcp  pool_type.h pool_config.h  protocol  rewrite  version.h  utils  watchdog  config.h  config.h.in  pool_config_variables.h
+       parser  pool.h  pcp  pool_type.h pool_config.h  protocol  rewrite  version.h  utils  watchdog  config.h  config.h.in  pool_config_variables.h pgproto
 
 all: config.h
        $(MAKE) $(AM_MAKEFLAGS) all-am
index 173bfec1099e0c5cfddd6a1c2d556e31f39a9e72..f9163cfb6de4cd5b92aa1ec25295aaa328753e4d 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
 #include <libpq-fe.h>
-#include "read.h"
-#include "buffer.h"
+#include "pgproto/read.h"
+#include "pgproto/buffer.h"
 
 /*
  * Read integer field and returns it.  The pointer in the buffer afer reading
diff --git a/src/tools/pgproto/buffer.h b/src/tools/pgproto/buffer.h
deleted file mode 100644 (file)
index 087798c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2017  Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- */
-
-#ifndef BUFFER_H
-
-#define BUFFER_H
-
-#define SKIP_TABS(p) while (*p == '\t') {p++;}
-
-extern int     buffer_read_int(char *buf, char **bufp);
-extern char *buffer_read_string(char *buf, char **bufp);
-extern char buffer_read_char(char *buf, char **bufp);
-
-#endif
index 753df958db0dc993fbb3b1fcde37aee32a6bdf88..4fc01557a9dda43904836f91d27b7834031472c7 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
 #include <libpq-fe.h>
-#include "read.h"
-#include "send.h"
-#include "extended_query.h"
-#include "buffer.h"
+#include "pgproto/read.h"
+#include "pgproto/send.h"
+#include "pgproto/extended_query.h"
+#include "pgproto/buffer.h"
 
 /*
  * Send parse messae. "conn" should at the point right after the message kind
diff --git a/src/tools/pgproto/extended_query.h b/src/tools/pgproto/extended_query.h
deleted file mode 100644 (file)
index 02301d8..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017  Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * Process Parse, Bind, Execute message.
- */
-
-#ifndef EXTENDED_QUERY_H
-#define EXTENDED_QUERY_H
-
-extern void process_parse(char *buf, PGconn *conn);
-extern void process_bind(char *buf, PGconn *conn);
-extern void process_execute(char *buf, PGconn *conn);
-extern void process_describe(char *buf, PGconn *conn);
-extern void process_close(char *buf, PGconn *conn);
-
-#endif
index 704fb25b46ad5f161e742f38565b4db9b0abb842..05947605772c37258ab0a7e96617fee6b920a352 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
 
 static inline void *
 pg_malloc_internal(size_t size, int flags)
diff --git a/src/tools/pgproto/fe_memutils.h b/src/tools/pgproto/fe_memutils.h
deleted file mode 100644 (file)
index 0167b96..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *     fe_memutils.h
- *             memory management support for frontend code
- *
- *     Copyright (c) 2003-2017, PostgreSQL Global Development Group
- *
- *     src/include/common/fe_memutils.h
- */
-#ifndef FE_MEMUTILS_H
-#define FE_MEMUTILS_H
-
-typedef size_t Size;
-
-/*
- * Flags for pg_malloc_extended and palloc_extended, deliberately named
- * the same as the backend flags.
- */
-#define MCXT_ALLOC_HUGE                        0x01    /* allow huge allocation (> 1 GB) not
-                                                                                * actually used for frontends */
-#define MCXT_ALLOC_NO_OOM              0x02    /* no failure if out-of-memory */
-#define MCXT_ALLOC_ZERO                        0x04    /* zero allocated memory */
-
-/*
- * "Safe" memory allocation functions --- these exit(1) on failure
- * (except pg_malloc_extended with MCXT_ALLOC_NO_OOM)
- */
-extern char *pg_strdup(const char *in);
-extern void *pg_malloc(size_t size);
-extern void *pg_malloc0(size_t size);
-extern void *pg_malloc_extended(size_t size, int flags);
-extern void *pg_realloc(void *pointer, size_t size);
-extern void pg_free(void *pointer);
-
-/* Equivalent functions, deliberately named the same as backend functions */
-extern char *pstrdup(const char *in);
-extern void *palloc(Size size);
-extern void *palloc0(Size size);
-extern void *palloc_extended(Size size, int flags);
-extern void *repalloc(void *pointer, Size size);
-extern void pfree(void *pointer);
-
-#ifdef NOT_USED
-/* sprintf into a palloc'd buffer --- these are in psprintf.c */
-extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2);
-extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0);
-#endif
-
-#define MEMSET_LOOP_LIMIT 1024
-
-/*
- * MemSet
- *     Exactly the same as standard library function memset(), but considerably
- *     faster for zeroing small word-aligned structures (such as parsetree nodes).
- *     This has to be a macro because the main point is to avoid function-call
- *     overhead.   However, we have also found that the loop is faster than
- *     native libc memset() on some platforms, even those with assembler
- *     memset() functions.  More research needs to be done, perhaps with
- *     MEMSET_LOOP_LIMIT tests in configure.
- */
-#define MemSet(start, val, len) \
-       do \
-       { \
-               /* must be void* because we don't know if it is integer aligned yet */ \
-               void   *_vstart = (void *) (start); \
-               int             _val = (val); \
-               Size    _len = (len); \
-\
-               if ((((uintptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \
-                       (_len & LONG_ALIGN_MASK) == 0 && \
-                       _val == 0 && \
-                       _len <= MEMSET_LOOP_LIMIT && \
-                       /* \
-                        *      If MEMSET_LOOP_LIMIT == 0, optimizer should find \
-                        *      the whole "if" false at compile time. \
-                        */ \
-                       MEMSET_LOOP_LIMIT != 0) \
-               { \
-                       long *_start = (long *) _vstart; \
-                       long *_stop = (long *) ((char *) _start + _len); \
-                       while (_start < _stop) \
-                               *_start++ = 0; \
-               } \
-               else \
-                       memset(_vstart, _val, _len); \
-       } while (0)
-
-/* originaly gettext staff */
-#define _(x) x
-
-/* Get a bit mask of the bits set in non-long aligned addresses */
-#define LONG_ALIGN_MASK (sizeof(long) - 1)
-
-#endif                                                 /* FE_MEMUTILS_H */
index 5e628452239cfd01ae37420f083c735f14200a26..31d119c509dfbbd408e7e604891c6b44c9188e98 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
 #include <libpq-fe.h>
-#include "read.h"
-#include "send.h"
-#include "buffer.h"
-#include "extended_query.h"
+#include "pgproto/read.h"
+#include "pgproto/send.h"
+#include "pgproto/buffer.h"
+#include "pgproto/extended_query.h"
 
 #undef DEBUG
 
diff --git a/src/tools/pgproto/pgproto.h b/src/tools/pgproto/pgproto.h
deleted file mode 100644 (file)
index 9be9815..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017-2018     Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- */
-
-#ifndef PGPROTO_H
-#define PGPROTO_H
-
-/*
- * The default file name for protocol data to be sent from frontend to backend
- */
-#define PGPROTODATA "pgproto.data"
-
-#define MAXENTRIES 128
-
-/*
- * Protocol data representation read from the data file.
- * We assume that the protocol version is V3.
- */
-typedef struct
-{
-       char            type;                   /* message type */
-       int                     size;                   /* message length excluding this (in host
-                                                                * order) */
-       char            message[1];             /* actual message (variable length) */
-}                      PROTO_DATA;
-
-extern int     read_nap;
-
-#endif                                                 /* PGPROTO_H */
index 1d8dd4d5cb70c7527059b9a7065e787977a03ac1..11c5a8f9898345d735165de40f57fcf465992086 100644 (file)
  */
 
 #include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <arpa/inet.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
 #include <libpq-fe.h>
-#include "read.h"
+#include "pgproto/read.h"
 
 static char read_char(PGconn *conn);
 static int     read_int32(PGconn *conn);
diff --git a/src/tools/pgproto/read.h b/src/tools/pgproto/read.h
deleted file mode 100644 (file)
index b60f1a9..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2017  Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- */
-
-#ifndef READ_H
-#define READ_H
-
-extern void read_until_ready_for_query(PGconn *conn, int check_input);
-#endif
index c31b224fec7c6530bca7035993ef4e52b91fcd35..77faad7b6c6374a2300e95b4dbde1cccfcc7422b 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include "../../include/config.h"
-#include "pgproto.h"
+#include "pgproto/pgproto.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <arpa/inet.h>
-#include "fe_memutils.h"
+#include "pgproto/fe_memutils.h"
 #include <libpq-fe.h>
-#include "read.h"
-#include "send.h"
+#include "pgproto/read.h"
+#include "pgproto/send.h"
 
 /*
  * Send a character to the connection.
diff --git a/src/tools/pgproto/send.h b/src/tools/pgproto/send.h
deleted file mode 100644 (file)
index 9ce8d9d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2017  Tatsuo Ishii
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of the
- * author not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The author makes no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- */
-
-#ifndef SEND_H
-#define SEND_H
-
-extern void send_char(char c, PGconn *conn);
-extern void send_int(int intval, PGconn *conn);
-extern void send_int16(short shortval, PGconn *conn);
-extern void send_string(char *buf, PGconn *conn);
-extern void send_byte(char *buf, int len, PGconn *conn);
-
-#endif