From 8a03f3062f43a0a54cfcf935746d2ed9d9ab269a Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Sun, 26 Nov 2000 09:34:01 +0000 Subject: - Add bcmath to the standard UNIX build - Change a couple of malloc()'s and free()'s to emalloc()'s and efree()'s --- ext/bcmath/libbcmath/src/Makefile.in | 323 +---------------------------------- ext/bcmath/libbcmath/src/config.h | 2 +- ext/bcmath/libbcmath/src/div.c | 12 +- ext/bcmath/libbcmath/src/num2str.c | 4 +- ext/bcmath/libbcmath/src/output.c | 2 +- ext/bcmath/libbcmath/src/recmul.c | 2 +- 6 files changed, 17 insertions(+), 328 deletions(-) (limited to 'ext/bcmath/libbcmath/src') diff --git a/ext/bcmath/libbcmath/src/Makefile.in b/ext/bcmath/libbcmath/src/Makefile.in index 9864968413..f4a235f94a 100644 --- a/ext/bcmath/libbcmath/src/Makefile.in +++ b/ext/bcmath/libbcmath/src/Makefile.in @@ -1,318 +1,7 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +LTLIBRARY_NAME = libbcmath.la +LTLIBRARY_SOURCES = add.c div.c init.c neg.c outofmem.c raisemod.c rt.c sub.c \ + compare.c divmod.c int2num.c num2long.c output.c recmul.c \ + sqrt.c zero.c debug.c doaddsub.c nearzero.c num2str.c raise.c \ + rmzero.c str2num.c -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Makefile for bcmath library - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -CC = @CC@ -MAKEINFO = @MAKEINFO@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -VERSION = @VERSION@ - -lib_LIBRARIES = libbcmath.a - -include_HEADERS = bcmath.h - -libbcmath_a_SOURCES = add.c compare.c debug.c div.c divmod.c doaddsub.c init.c int2num.c nearzero.c neg.c num2long.c num2str.c output.c raise.c raisemod.c recmul.c rmzero.c sqrt.c str2num.c sub.c zero.c outofmem.c rt.c - - -INCLUDES = -I$(srcdir) -I.. - -CFLAGS = @CFLAGS@ $(INCLUDES) -Wall - -MAINTAINERCLEANFILES = Makefile.in $(libbcmath_a_SOURCES) private.h bcmath.h -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(lib_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I.. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -libbcmath_a_LIBADD = -libbcmath_a_OBJECTS = add.o compare.o debug.o div.o divmod.o doaddsub.o \ -init.o int2num.o nearzero.o neg.o num2long.o num2str.o output.o raise.o \ -raisemod.o recmul.o rmzero.o sqrt.o str2num.o sub.o zero.o outofmem.o \ -rt.o -AR = ar -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -HEADERS = $(include_HEADERS) - -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -SOURCES = $(libbcmath_a_SOURCES) -OBJECTS = $(libbcmath_a_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps src/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-libLIBRARIES: - -clean-libLIBRARIES: - -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) - -distclean-libLIBRARIES: - -maintainer-clean-libLIBRARIES: - -install-libLIBRARIES: $(lib_LIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ - $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ - else :; fi; \ - done - @$(POST_INSTALL) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ - $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ - else :; fi; \ - done - -uninstall-libLIBRARIES: - @$(NORMAL_UNINSTALL) - list='$(lib_LIBRARIES)'; for p in $$list; do \ - rm -f $(DESTDIR)$(libdir)/$$p; \ - done - -.c.o: - $(COMPILE) -c $< - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -libbcmath.a: $(libbcmath_a_OBJECTS) $(libbcmath_a_DEPENDENCIES) - -rm -f libbcmath.a - $(AR) cru libbcmath.a $(libbcmath_a_OBJECTS) $(libbcmath_a_LIBADD) - $(RANLIB) libbcmath.a - -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(includedir) - @list='$(include_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ - echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ - $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - list='$(include_HEADERS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(includedir)/$$p; \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = src - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-libLIBRARIES -install-exec: install-exec-am - -install-data-am: install-includeHEADERS -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-libLIBRARIES uninstall-includeHEADERS -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -mostlyclean-am: mostlyclean-libLIBRARIES mostlyclean-compile \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-libLIBRARIES clean-compile clean-tags clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-libLIBRARIES distclean-compile distclean-tags \ - distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-libLIBRARIES \ - maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ -clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ -install-libLIBRARIES mostlyclean-compile distclean-compile \ -clean-compile maintainer-clean-compile uninstall-includeHEADERS \ -install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -all: $(bin_LIBRARIES) - -clean: - rm -f $(OBJS) $(LIB) *~ - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/bcmath/libbcmath/src/config.h b/ext/bcmath/libbcmath/src/config.h index 7ac09a9993..42c42a8948 100644 --- a/ext/bcmath/libbcmath/src/config.h +++ b/ext/bcmath/libbcmath/src/config.h @@ -1,7 +1,7 @@ #if PHP_WIN32 #include "../../../../main/config.w32.h" #else -#include "../../../../main/php_config.h" +#include "php_config.h" #endif #include diff --git a/ext/bcmath/libbcmath/src/div.c b/ext/bcmath/libbcmath/src/div.c index db88ebaf99..62f24dd494 100644 --- a/ext/bcmath/libbcmath/src/div.c +++ b/ext/bcmath/libbcmath/src/div.c @@ -129,13 +129,13 @@ bc_divide (n1, n2, quot, scale) extra = scale - scale1; else extra = 0; - num1 = (unsigned char *) malloc (n1->n_len+n1->n_scale+extra+2); + num1 = (unsigned char *) emalloc (n1->n_len+n1->n_scale+extra+2); if (num1 == NULL) bc_out_of_memory(); memset (num1, 0, n1->n_len+n1->n_scale+extra+2); memcpy (num1+1, n1->n_value, n1->n_len+n1->n_scale); len2 = n2->n_len + scale2; - num2 = (unsigned char *) malloc (len2+1); + num2 = (unsigned char *) emalloc (len2+1); if (num2 == NULL) bc_out_of_memory(); memcpy (num2, n2->n_value, len2); *(num2+len2) = 0; @@ -166,7 +166,7 @@ bc_divide (n1, n2, quot, scale) memset (qval->n_value, 0, qdigits); /* Allocate storage for the temporary storage mval. */ - mval = (unsigned char *) malloc (len2+1); + mval = (unsigned char *) emalloc (len2+1); if (mval == NULL) bc_out_of_memory (); /* Now for the full divide algorithm. */ @@ -267,9 +267,9 @@ bc_divide (n1, n2, quot, scale) *quot = qval; /* Clean up temporary storage. */ - free (mval); - free (num1); - free (num2); + efree (mval); + efree (num1); + efree (num2); return 0; /* Everything is OK. */ } diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c index 6a4a055ca1..c47ec9bbad 100644 --- a/ext/bcmath/libbcmath/src/num2str.c +++ b/ext/bcmath/libbcmath/src/num2str.c @@ -51,9 +51,9 @@ char /* Allocate the string memory. */ signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */ if (num->n_scale > 0) - str = (char *) malloc (num->n_len + num->n_scale + 2 + signch); + str = (char *) emalloc (num->n_len + num->n_scale + 2 + signch); else - str = (char *) malloc (num->n_len + 1 + signch); + str = (char *) emalloc (num->n_len + 1 + signch); if (str == NULL) bc_out_of_memory(); /* The negative sign if needed. */ diff --git a/ext/bcmath/libbcmath/src/output.c b/ext/bcmath/libbcmath/src/output.c index 9cf8440a42..e41479d2d3 100644 --- a/ext/bcmath/libbcmath/src/output.c +++ b/ext/bcmath/libbcmath/src/output.c @@ -176,7 +176,7 @@ bc_out_num (num, o_base, out_char, leading_zero) (*out_char) (ref_str[ (int) temp->digit]); else bc_out_long (temp->digit, max_o_digit->n_len, 1, out_char); - free (temp); + efree (temp); } } diff --git a/ext/bcmath/libbcmath/src/recmul.c b/ext/bcmath/libbcmath/src/recmul.c index c30bf8cb64..73f67af574 100644 --- a/ext/bcmath/libbcmath/src/recmul.c +++ b/ext/bcmath/libbcmath/src/recmul.c @@ -61,7 +61,7 @@ new_sub_num (length, scale, value) temp = _bc_Free_list; _bc_Free_list = temp->n_next; } else { - temp = (bc_num) malloc (sizeof(bc_struct)); + temp = (bc_num) emalloc (sizeof(bc_struct)); if (temp == NULL) bc_out_of_memory (); } temp->n_sign = PLUS; -- cgit v1.2.1