[xiph-commits] r13395 - in experimental/moritz/xalloc: . win32

moritz at svn.xiph.org moritz at svn.xiph.org
Sun Jul 29 17:17:29 PDT 2007


Author: moritz
Date: 2007-07-29 17:17:28 -0700 (Sun, 29 Jul 2007)
New Revision: 13395

Added:
   experimental/moritz/xalloc/win32/
   experimental/moritz/xalloc/win32/libxalloc.sln
   experimental/moritz/xalloc/win32/libxalloc.vcproj
Modified:
   experimental/moritz/xalloc/Makefile
   experimental/moritz/xalloc/config.h
   experimental/moritz/xalloc/xalloc.c
   experimental/moritz/xalloc/xalloc.h
Log:
More. This is fairly complete by now ...


Modified: experimental/moritz/xalloc/Makefile
===================================================================
--- experimental/moritz/xalloc/Makefile	2007-07-30 00:16:36 UTC (rev 13394)
+++ experimental/moritz/xalloc/Makefile	2007-07-30 00:17:28 UTC (rev 13395)
@@ -1,18 +1,21 @@
 PROG =		xalloc-test
+LIB =		libxalloc.a
 
-SRC =		main.c xalloc.c
-OBJ =		main.o xalloc.o
+SRC =		main.c
+OBJ =		main.o
+LIBSRC =	xalloc.c
+LIBOBJ =	xalloc.o
 
 THREADS =	-pthread
 CC ?=		gcc
 CFLAGS ?=	-O2 -pipe
-CFLAGS +=	-DHAVE_CONFIG_H=1 -fstrict-aliasing -Wall -W -ansi -pedantic -Wwrite-strings -Wpointer-arith $(THREADS)
+CFLAGS +=	-DHAVE_CONFIG_H=1 -DXALLOC_DEBUG=1 -DXALLOC_WITH_XASPRINTF=1 -fstrict-aliasing -Wall -W -ansi -pedantic -Wwrite-strings -Wpointer-arith $(THREADS)
 DEBUG ?=	-g -ggdb
 INCLUDEFLAGS =	-I../compat
-LDFLAGS =	$(THREADS)
+LDFLAGS =	-L. -lxalloc $(THREADS)
 
 
-all: depend $(PROG)
+all: depend $(LIB) $(PROG)
 
 depend: $(SRC)
 	$(CC) -M $(CFLAGS) $(INCLUDEFLAGS) $(SRC) > .depend
@@ -20,8 +23,14 @@
 .c.o: $(SRC)
 	$(CC) $(CFLAGS) $(DEBUG) $(INCLUDEFLAGS) -c $<
 
+lib: $(LIB)
+
+$(LIB): $(LIBOBJ)
+	ar cru $(LIB) $(LIBOBJ)
+	ranlib $(LIB)
+
 $(PROG): $(OBJ)
 	$(CC) $(DEBUG) $(OBJ) $(LDFLAGS) -o $(PROG)
 
 clean:
-	- at rm *.o *~ *.core core .depend $(PROG)
+	- at rm *.o *~ *.core core .depend $(PROG) $(LIB)

Modified: experimental/moritz/xalloc/config.h
===================================================================
--- experimental/moritz/xalloc/config.h	2007-07-30 00:16:36 UTC (rev 13394)
+++ experimental/moritz/xalloc/config.h	2007-07-30 00:17:28 UTC (rev 13395)
@@ -1,20 +1,4 @@
-#if !defined(WIN32)
-
-# define HAVE_SYS_TIME_H 	1
-# define HAVE_SYS_TREE_H	1
-# define HAVE_SYS_TYPES_H	1
-# define HAVE_SYS_WAIT_H 	1
-# define HAVE_GETTIMEOFDAY	1
-# define HAVE_SETPROCTITLE	1
-# define HAVE_SIGNAL_H		1
-# define HAVE_STDINT_H		1
-# define HAVE_UNISTD_H		1
-
-#else
-
-# define HAVE_SYS_TIMEB_H	1
-# define HAVE_FTIME		1
-# define HAVE_SIGNAL_H		1
-# define HAVE_WINDOWS_H 	1
-
-#endif /* !WIN32 */
+#define HAVE_SYS_TYPES_H	1
+#define HAVE_SYS_TREE_H 	1
+#define HAVE_ASPRINTF		1
+/* #define HAVE_BROKEN_VSNPRINTF	1 */

Added: experimental/moritz/xalloc/win32/libxalloc.sln
===================================================================
--- experimental/moritz/xalloc/win32/libxalloc.sln	                        (rev 0)
+++ experimental/moritz/xalloc/win32/libxalloc.sln	2007-07-30 00:17:28 UTC (rev 13395)
@@ -0,0 +1,40 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxalloc", "libxalloc.vcproj", "{ED9F1811-718B-40CE-95FA-E9409F77D8F0}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B} = {0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "..\..\pthreads\pthread.vcproj", "{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Debug Static = Debug Static
+		Release = Release
+		Release Static = Release Static
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{ED9F1811-718B-40CE-95FA-E9409F77D8F0}.Debug.ActiveCfg = Debug|Win32
+		{ED9F1811-718B-40CE-95FA-E9409F77D8F0}.Debug.Build.0 = Debug|Win32
+		{ED9F1811-718B-40CE-95FA-E9409F77D8F0}.Debug Static.ActiveCfg = Debug|Win32
+		{ED9F1811-718B-40CE-95FA-E9409F77D8F0}.Debug Static.Build.0 = Debug|Win32
+		{ED9F1811-718B-40CE-95FA-E9409F77D8F0}.Release.ActiveCfg = Release|Win32
+		{ED9F1811-718B-40CE-95FA-E9409F77D8F0}.Release.Build.0 = Release|Win32
+		{ED9F1811-718B-40CE-95FA-E9409F77D8F0}.Release Static.ActiveCfg = Release|Win32
+		{ED9F1811-718B-40CE-95FA-E9409F77D8F0}.Release Static.Build.0 = Release|Win32
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}.Debug.ActiveCfg = Debug|Win32
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}.Debug.Build.0 = Debug|Win32
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}.Debug Static.ActiveCfg = Debug Static|Win32
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}.Debug Static.Build.0 = Debug Static|Win32
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}.Release.ActiveCfg = Release|Win32
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}.Release.Build.0 = Release|Win32
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}.Release Static.ActiveCfg = Release Static|Win32
+		{0ACFE379-35EA-4FDC-B0F1-40C9D0E7EE2B}.Release Static.Build.0 = Release Static|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal

Added: experimental/moritz/xalloc/win32/libxalloc.vcproj
===================================================================
--- experimental/moritz/xalloc/win32/libxalloc.vcproj	                        (rev 0)
+++ experimental/moritz/xalloc/win32/libxalloc.vcproj	2007-07-30 00:17:28 UTC (rev 13395)
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="libxalloc"
+	ProjectGUID="{ED9F1811-718B-40CE-95FA-E9409F77D8F0}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="4"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\compat;..\..\pthreads"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;XALLOC_DEBUG;THREAD_SAFE"
+				StringPooling="TRUE"
+				MinimalRebuild="TRUE"
+				ExceptionHandling="FALSE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="TRUE"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderThrough=""
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libxalloc.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="4"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\compat;..\..\pthreads"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;THREAD_SAFE"
+				StringPooling="TRUE"
+				ExceptionHandling="FALSE"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="TRUE"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderThrough=""
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/libxalloc.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath="..\xalloc.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath="..\xalloc.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: experimental/moritz/xalloc/xalloc.c
===================================================================
--- experimental/moritz/xalloc/xalloc.c	2007-07-30 00:16:36 UTC (rev 13394)
+++ experimental/moritz/xalloc/xalloc.c	2007-07-30 00:17:28 UTC (rev 13395)
@@ -67,7 +67,7 @@
 # ifdef HAVE_SYS_TREE_H
 #  include <sys/tree.h>
 # else
-#  include "compat/sys/tree.h"
+#  include "sys/tree.h"
 # endif
 
 int	_memory_cmp(void *, void *);
@@ -117,7 +117,11 @@
 	struct memory	*a = (struct memory *)arg_a;
 	struct memory	*b = (struct memory *)arg_b;
 
-	return ((int)a->ptr - (int)b->ptr);
+	if (a->ptr < b->ptr)
+		return (-1);
+	else if (a->ptr > b->ptr)
+		return (1);
+	return (0);
 }
 
 void

Modified: experimental/moritz/xalloc/xalloc.h
===================================================================
--- experimental/moritz/xalloc/xalloc.h	2007-07-30 00:16:36 UTC (rev 13394)
+++ experimental/moritz/xalloc/xalloc.h	2007-07-30 00:17:28 UTC (rev 13395)
@@ -43,9 +43,9 @@
  * variadic macros, and work only on systems with vasprintf() or vsnprintf(),
  * and MS Windows.
  */
-#define XALLOC_DEBUG 1
+/* #define XALLOC_DEBUG 1 */
 /* #define XALLOC_SILENT 1 */
-#define XALLOC_WITH_XASPRINTF 1
+/* #define XALLOC_WITH_XASPRINTF 1 */
 
 /* The default output stream for messages: */
 #define XALLOC_DEFAULT_OUTPUT	stderr



More information about the commits mailing list