mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Win32 compile fixes for pgbench, pgcrypto, and tsearch.
Claudio Natoli
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.32 2004/08/29 05:06:36 momjian Exp $
|
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.33 2004/09/14 03:39:23 tgl Exp $
|
||||||
*
|
*
|
||||||
* pgbench: a simple TPC-B like benchmark program for PostgreSQL
|
* pgbench: a simple TPC-B like benchmark program for PostgreSQL
|
||||||
* written by Tatsuo Ishii
|
* written by Tatsuo Ishii
|
||||||
@ -44,6 +44,10 @@
|
|||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind;
|
extern int optind;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#undef select
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* some configurable parameters */
|
* some configurable parameters */
|
||||||
@ -705,7 +709,7 @@ main(int argc, char **argv)
|
|||||||
int nsocks; /* return from select(2) */
|
int nsocks; /* return from select(2) */
|
||||||
int maxsock; /* max socket number to be waited */
|
int maxsock; /* max socket number to be waited */
|
||||||
|
|
||||||
#ifndef __CYGWIN__
|
#if !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||||
struct rlimit rlim;
|
struct rlimit rlim;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -755,7 +759,7 @@ main(int argc, char **argv)
|
|||||||
fprintf(stderr, "invalid number of clients: %d\n", nclients);
|
fprintf(stderr, "invalid number of clients: %d\n", nclients);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#ifndef __CYGWIN__
|
#if !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||||
#ifdef RLIMIT_NOFILE /* most platform uses RLIMIT_NOFILE */
|
#ifdef RLIMIT_NOFILE /* most platform uses RLIMIT_NOFILE */
|
||||||
if (getrlimit(RLIMIT_NOFILE, &rlim) == -1)
|
if (getrlimit(RLIMIT_NOFILE, &rlim) == -1)
|
||||||
{
|
{
|
||||||
@ -772,7 +776,7 @@ main(int argc, char **argv)
|
|||||||
fprintf(stderr, "Use limit/ulimt to increase the limit before using pgbench.\n");
|
fprintf(stderr, "Use limit/ulimt to increase the limit before using pgbench.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif /* #ifndef __CYGWIN__ */
|
#endif /* #if !(defined(__CYGWIN__) || defined(__MINGW32__)) */
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
is_connect = 1;
|
is_connect = 1;
|
||||||
@ -935,7 +939,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* set random seed */
|
/* set random seed */
|
||||||
gettimeofday(&tv1, 0);
|
gettimeofday(&tv1, 0);
|
||||||
srand((uint) tv1.tv_usec);
|
srand((unsigned int) tv1.tv_usec);
|
||||||
|
|
||||||
/* get start up time */
|
/* get start up time */
|
||||||
gettimeofday(&tv1, 0);
|
gettimeofday(&tv1, 0);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.11 2004/08/20 20:13:06 momjian Exp $
|
# $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.12 2004/09/14 03:39:48 tgl Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
# either 'builtin', 'mhash', 'openssl'
|
# either 'builtin', 'mhash', 'openssl'
|
||||||
@ -82,6 +82,11 @@ include $(top_builddir)/src/Makefile.global
|
|||||||
include $(top_srcdir)/contrib/contrib-global.mk
|
include $(top_srcdir)/contrib/contrib-global.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# to make ws2_32.lib the last library (must occur after definition of PORTNAME)
|
||||||
|
ifeq ($(PORTNAME),win32)
|
||||||
|
SHLIB_LINK += -lwsock32 -lws2_32
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
rijndael.o: rijndael.tbl
|
rijndael.o: rijndael.tbl
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ typedef char *BITVECP;
|
|||||||
#define GETBIT(x,i) ( (GETBYTE(x,i) >> ( (i) % BITBYTE )) & 0x01 )
|
#define GETBIT(x,i) ( (GETBYTE(x,i) >> ( (i) % BITBYTE )) & 0x01 )
|
||||||
|
|
||||||
#define abs(a) ((a) < (0) ? -(a) : (a))
|
#define abs(a) ((a) < (0) ? -(a) : (a))
|
||||||
|
#ifdef min
|
||||||
|
#undef min
|
||||||
|
#endif
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||||
#define HASHVAL(val) (((unsigned int)(val)) % SIGLENBIT)
|
#define HASHVAL(val) (((unsigned int)(val)) % SIGLENBIT)
|
||||||
#define HASH(sign, val) SETBIT((sign), HASHVAL(val))
|
#define HASH(sign, val) SETBIT((sign), HASHVAL(val))
|
||||||
|
@ -174,6 +174,9 @@ clean_NOT(ITEM * ptr, int4 *len)
|
|||||||
return plaintree(clean_NOT_intree(root), len);
|
return plaintree(clean_NOT_intree(root), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef V_UNKNOWN /* apparently Windows defines this :-( */
|
||||||
|
#undef V_UNKNOWN
|
||||||
|
#endif
|
||||||
#define V_UNKNOWN 0
|
#define V_UNKNOWN 0
|
||||||
#define V_TRUE 1
|
#define V_TRUE 1
|
||||||
#define V_FALSE 2
|
#define V_FALSE 2
|
||||||
|
@ -342,11 +342,11 @@ typedef struct
|
|||||||
{
|
{
|
||||||
uint16 len;
|
uint16 len;
|
||||||
char *word;
|
char *word;
|
||||||
} WORD;
|
} WORD_T; /* WORD type defined on win32; we'll use WORD_T */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
WORD *words;
|
WORD_T *words;
|
||||||
int4 lenwords;
|
int4 lenwords;
|
||||||
int4 curwords;
|
int4 curwords;
|
||||||
} PRSTEXT;
|
} PRSTEXT;
|
||||||
@ -369,7 +369,7 @@ parsetext(PRSTEXT * prs, char *buf, int4 buflen)
|
|||||||
if (prs->curwords == prs->lenwords)
|
if (prs->curwords == prs->lenwords)
|
||||||
{
|
{
|
||||||
prs->lenwords *= 2;
|
prs->lenwords *= 2;
|
||||||
prs->words = (WORD *) repalloc((void *) prs->words, prs->lenwords * sizeof(WORD));
|
prs->words = (WORD_T *) repalloc((void *) prs->words, prs->lenwords * sizeof(WORD_T));
|
||||||
}
|
}
|
||||||
if (tokenlen > 0xffff)
|
if (tokenlen > 0xffff)
|
||||||
{
|
{
|
||||||
@ -410,18 +410,18 @@ parsetext(PRSTEXT * prs, char *buf, int4 buflen)
|
|||||||
static int
|
static int
|
||||||
compareWORD(const void *a, const void *b)
|
compareWORD(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
if (((WORD *) a)->len == ((WORD *) b)->len)
|
if (((WORD_T *) a)->len == ((WORD_T *) b)->len)
|
||||||
return strncmp(
|
return strncmp(
|
||||||
((WORD *) a)->word,
|
((WORD_T *) a)->word,
|
||||||
((WORD *) b)->word,
|
((WORD_T *) b)->word,
|
||||||
((WORD *) b)->len);
|
((WORD_T *) b)->len);
|
||||||
return (((WORD *) a)->len > ((WORD *) b)->len) ? 1 : -1;
|
return (((WORD_T *) a)->len > ((WORD_T *) b)->len) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
uniqueWORD(WORD * a, int4 l)
|
uniqueWORD(WORD_T * a, int4 l)
|
||||||
{
|
{
|
||||||
WORD *ptr,
|
WORD_T *ptr,
|
||||||
*res;
|
*res;
|
||||||
|
|
||||||
if (l == 1)
|
if (l == 1)
|
||||||
@ -430,7 +430,7 @@ uniqueWORD(WORD * a, int4 l)
|
|||||||
res = a;
|
res = a;
|
||||||
ptr = a + 1;
|
ptr = a + 1;
|
||||||
|
|
||||||
qsort((void *) a, l, sizeof(WORD), compareWORD);
|
qsort((void *) a, l, sizeof(WORD_T), compareWORD);
|
||||||
|
|
||||||
while (ptr - a < l)
|
while (ptr - a < l)
|
||||||
{
|
{
|
||||||
@ -500,7 +500,7 @@ txt2txtidx(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
prs.lenwords = 32;
|
prs.lenwords = 32;
|
||||||
prs.curwords = 0;
|
prs.curwords = 0;
|
||||||
prs.words = (WORD *) palloc(sizeof(WORD) * prs.lenwords);
|
prs.words = (WORD_T *) palloc(sizeof(WORD_T) * prs.lenwords);
|
||||||
|
|
||||||
initmorph();
|
initmorph();
|
||||||
parsetext(&prs, VARDATA(in), VARSIZE(in) - VARHDRSZ);
|
parsetext(&prs, VARDATA(in), VARSIZE(in) - VARHDRSZ);
|
||||||
@ -564,7 +564,7 @@ tsearch(PG_FUNCTION_ARGS)
|
|||||||
errmsg("could not find txtidx_field")));
|
errmsg("could not find txtidx_field")));
|
||||||
prs.lenwords = 32;
|
prs.lenwords = 32;
|
||||||
prs.curwords = 0;
|
prs.curwords = 0;
|
||||||
prs.words = (WORD *) palloc(sizeof(WORD) * prs.lenwords);
|
prs.words = (WORD_T *) palloc(sizeof(WORD_T) * prs.lenwords);
|
||||||
|
|
||||||
initmorph();
|
initmorph();
|
||||||
/* find all words in indexable column */
|
/* find all words in indexable column */
|
||||||
|
Reference in New Issue
Block a user