Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7793c6e

Browse files
author
Michael Meskes
committed
Cleaned up ecpglib and renamed functions that do not need to be exported.
Created export list for ecpglib.
1 parentc4a6c2f commit7793c6e

File tree

51 files changed

+1749
-1650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1749
-1650
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,5 +2256,8 @@ Tue, 02 Oct 2007 11:32:25 +0200
22562256
Wed, 03 Oct 2007 10:48:39 +0200
22572257

22582258
- Hopefully fixed some stuff that causes Windows builds to fail.
2259+
- Cleaned up ecpglib and renamed functions that do not need to be
2260+
exported.
2261+
- Created export list for ecpglib.
22592262
- Set ecpg library version to 6.0.
22602263
- Set ecpg version to 4.4.

‎src/interfaces/ecpg/compatlib/informix.c

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.49 2007/08/14 10:01:52 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.50 2007/10/03 11:11:11 meskes Exp $ */
22

33
#include<stdlib.h>
44
#include<string.h>
@@ -7,14 +7,15 @@
77
#include<ctype.h>
88
#include<limits.h>
99

10+
#definePOSTGRES_ECPG_INTERNAL
1011
#include<ecpgtype.h>
1112
#include<ecpg_informix.h>
1213
#include<pgtypes_error.h>
1314
#include<pgtypes_date.h>
1415
#include<pgtypes_numeric.h>
1516
#include<sqltypes.h>
16-
17-
char*ECPGalloc(long,int);
17+
#include<sqlca.h>
18+
#include<ecpgerrno.h>
1819

1920
staticint
2021
deccall2(decimal*arg1,decimal*arg2,int (*ptr) (numeric*,numeric*))
@@ -667,7 +668,7 @@ static struct
667668
* initialize the struct, which holds the different forms
668669
* of the long value
669670
*/
670-
staticvoid
671+
staticint
671672
initValue(longlng_val)
672673
{
673674
inti,
@@ -701,7 +702,8 @@ initValue(long lng_val)
701702
value.remaining=value.digits;
702703

703704
/* convert the long to string */
704-
value.val_string= (char*)malloc(value.digits+1);
705+
if ((value.val_string= (char*)malloc(value.digits+1))==NULL)
706+
return-1;
705707
dig=value.val;
706708
for (i=value.digits,j=0;i>0;i--,j++)
707709
{
@@ -710,6 +712,7 @@ initValue(long lng_val)
710712
l /=10;
711713
}
712714
value.val_string[value.digits]='\0';
715+
return0;
713716
}
714717

715718
/* return the position oft the right-most dot in some string */
@@ -755,7 +758,11 @@ rfmtlong(long lng_val, char *fmt, char *outbuf)
755758
temp= (char*)malloc(fmt_len+1);
756759

757760
/* put all info about the long in a struct */
758-
initValue(lng_val);
761+
if (!temp||initValue(lng_val)==-1)
762+
{
763+
errno=ENOMEM;
764+
return-1;
765+
}
759766

760767
/* '<' is the only format, where we have to align left */
761768
if (strchr(fmt, (int)'<'))
@@ -991,11 +998,25 @@ ECPG_informix_set_var(int number, void *pointer, int lineno)
991998
}
992999

9931000
/* a new one has to be added */
994-
ptr= (structvar_list*)ECPGalloc(sizeof(structvar_list),lineno);
995-
ptr->number=number;
996-
ptr->pointer=pointer;
997-
ptr->next=ivlist;
998-
ivlist=ptr;
1001+
ptr= (structvar_list*)calloc(1L,sizeof(structvar_list));
1002+
if (!ptr)
1003+
{
1004+
structsqlca_t*sqlca=ECPGget_sqlca();
1005+
1006+
sqlca->sqlcode=ECPG_OUT_OF_MEMORY;
1007+
strncpy(sqlca->sqlstate,"YE001",sizeof("YE001"));
1008+
snprintf(sqlca->sqlerrm.sqlerrmc,sizeof(sqlca->sqlerrm.sqlerrmc),"Out of memory in line %d.",lineno);
1009+
sqlca->sqlerrm.sqlerrml=strlen(sqlca->sqlerrm.sqlerrmc);
1010+
/* free all memory we have allocated for the user */
1011+
ECPGfree_auto_mem();
1012+
}
1013+
else
1014+
{
1015+
ptr->number=number;
1016+
ptr->pointer=pointer;
1017+
ptr->next=ivlist;
1018+
ivlist=ptr;
1019+
}
9991020
}
10001021

10011022
void*

‎src/interfaces/ecpg/ecpglib/Makefile

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.48 2007/09/27 19:53:44 tgl Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.49 2007/10/03 11:11:12 meskes Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -31,6 +31,7 @@ OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
3131
# thread.c is needed only for non-WIN32 implementation of path.c
3232
ifneq ($(PORTNAME), win32)
3333
OBJS += thread.o
34+
DLL_DEFFILE=libecpgdll.def
3435
endif
3536

3637
SHLIB_LINK = -L../pgtypeslib -lpgtypes$(libpq) -lm$(PTHREAD_LIBS)
@@ -58,6 +59,52 @@ path.o: path.c $(top_builddir)/src/port/pg_config_paths.h
5859
$(top_builddir)/src/port/pg_config_paths.h:
5960
$(MAKE) -C$(top_builddir)/src/port pg_config_paths.h
6061

62+
# We need several not-quite-identical variants of .DEF files to build libecpg
63+
# DLLs for Windows. These are made from the single source file exports.txt.
64+
# Since we can't assume that Windows boxes will have sed, the .DEF files are
65+
# always built and included in distribution tarballs.
66+
67+
.PHONY: def-files
68+
def-files:$(srcdir)/libecpgdll.def$(srcdir)/blibecpgdll.def
69+
70+
$(srcdir)/libecpgdll.def: exports.txt
71+
echo'; DEF file for MS VC++'>$@
72+
echo'LIBRARY LIBECPG'>>$@
73+
echo'EXPORTS'>>$@
74+
sed -e'/^#/d' -e's/^\(.* \)\([0-9][0-9]*\)/ \1@ \2/'<$<>>$@
75+
76+
$(srcdir)/blibecpgdll.def: exports.txt
77+
echo'; DEF file for Borland C++ Builder'>$@
78+
echo'LIBRARY BLIBECPG'>>$@
79+
echo'EXPORTS'>>$@
80+
sed -e'/^#/d' -e's/^\(.* \)\([0-9][0-9]*\)/ _\1@ \2/'<$<>>$@
81+
echo''>>$@
82+
echo'; Aliases for MS compatible names'>>$@
83+
sed -e'/^#/d' -e's/^\(.* \)\([0-9][0-9]*\)/ \1= _\1/'<$<| sed's/ *$$//'>>$@
84+
85+
# Where possible, restrict the symbols exported by the library to just the
86+
# official list, so as to avoid unintentional ABI changes.
87+
88+
ifeq ($(PORTNAME), darwin)
89+
$(shlib): exports.list
90+
91+
exports.list: exports.txt
92+
$(AWK)'/^[^#]/ {printf "_%s\n",$$1}'$<>$@
93+
94+
exported_symbols_list = -exported_symbols_list exports.list
95+
endif
96+
97+
ifeq ($(PORTNAME), linux)
98+
$(shlib): exports.list
99+
100+
exports.list: exports.txt
101+
echo'{ global:'>$@
102+
$(AWK)'/^[^#]/ {printf "%s;\n",$$1}'$<>>$@
103+
echo' local: *; };'>>$@
104+
105+
exported_symbols_list = -Wl,--version-script=exports.list
106+
endif
107+
61108
install: all installdirs install-lib
62109

63110
installdirs:
@@ -66,4 +113,4 @@ installdirs:
66113
uninstall: uninstall-lib
67114

68115
cleandistcleanmaintainer-clean: clean-lib
69-
rm -f$(OBJS) path.c snprintf.c strlcpy.c thread.c
116+
rm -f$(OBJS) path.c snprintf.c strlcpy.c thread.c exports.list

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp