[postgis-commits] svn - r3114 - trunk/lwgeom

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Wed Oct 15 10:59:18 PDT 2008


Author: pramsey
Date: 2008-10-15 10:59:18 -0700 (Wed, 15 Oct 2008)
New Revision: 3114

Removed:
   trunk/lwgeom/stringBuffer.c
   trunk/lwgeom/stringBuffer.h
Modified:
   trunk/lwgeom/Makefile.in
   trunk/lwgeom/lwgeom_gist.c
Log:
Remove stringBuffer.* from build/repository.


Modified: trunk/lwgeom/Makefile.in
===================================================================
--- trunk/lwgeom/Makefile.in	2008-10-15 15:03:54 UTC (rev 3113)
+++ trunk/lwgeom/Makefile.in	2008-10-15 17:59:18 UTC (rev 3114)
@@ -32,7 +32,6 @@
 	lwgeom_gist.o \
 	lwgeom_btree.o \
 	lwgeom_transform.o \
-	stringBuffer.o \
 	lwgeom_box.o \
 	lwgeom_box3d.o \
 	lwgeom_box2dfloat4.o \

Modified: trunk/lwgeom/lwgeom_gist.c
===================================================================
--- trunk/lwgeom/lwgeom_gist.c	2008-10-15 15:03:54 UTC (rev 3113)
+++ trunk/lwgeom/lwgeom_gist.c	2008-10-15 17:59:18 UTC (rev 3114)
@@ -94,6 +94,8 @@
 	BOX2DFLOAT4 box1;
 	BOX2DFLOAT4 box2;
 
+	POSTGIS_DEBUG(2, "GIST: LWGEOM_overlap --entry");
+
 	if ( pglwgeom_getSRID(lwgeom1) != pglwgeom_getSRID(lwgeom2) )
 	{
 		PG_FREE_IF_COPY(lwgeom1, 0);

Deleted: trunk/lwgeom/stringBuffer.c
===================================================================
--- trunk/lwgeom/stringBuffer.c	2008-10-15 15:03:54 UTC (rev 3113)
+++ trunk/lwgeom/stringBuffer.c	2008-10-15 17:59:18 UTC (rev 3114)
@@ -1,94 +0,0 @@
-#include <postgres.h>
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-
-#include "stringBuffer.h"
-
-#define DEFAULT_STR_LENGTH_PADDING 10
-#define DEFAULT_PERCENT_SIZE_INCREASE 0.25
-
-/*NOTE: buffer->length does NOT include the null!!! */
-
-
-
-
-/*constructor for the string buffer */
-STRBUFF * new_strBUFF(int size) {
-	STRBUFF * buffer;
-	buffer = (STRBUFF *)palloc(sizeof(STRBUFF));
-	buffer->string = (char * )palloc(size);
-	buffer->size = size;
-	buffer->length = 0;
-	return buffer;
-}
-
-/*destructor */
-void delete_StrBUFF(STRBUFF* buffer) {
-	pfree(buffer->string);
-	pfree(buffer);
-}
-
-/*returns a CString contained in the buffer */
-char* to_CString(STRBUFF* buffer) {
-	char* resultStr;
-	if(buffer->length == 0) {
-		return NULL;
-	}
-
-	resultStr = (char * )palloc(buffer->length+1);
-	memcpy(resultStr, buffer->string, buffer->length+1);
-	return resultStr;
-}
-
-/*add a string to the buffer- calls catenate */
-void add_str_simple(STRBUFF* buffer, char* str) {
-	if(str == NULL) {
-		return;
-	}
-	catenate(buffer, str, strlen(str));
-}
-
-/* 
- * Adds the new string to the existing string in the buffer allocates
- */
-void catenate(STRBUFF *buffer, char* str, int strLength)
-{
-	/* not big enough to hold this + null termination */
-	if  (buffer->size <= (buffer->length+strLength)  )
-	{
-		/*need to re-allocate the buffer so its bigger */
-		char *old_buffer = buffer->string;
-		int  new_size    = getSize(buffer->size, buffer->length, strLength);  /*new size (always big enough) */
-
-		buffer->string = palloc(new_size);
-		buffer->size = new_size;
-		memcpy(buffer->string, old_buffer, buffer->length+1); /* copy old string (+1 = null term) */
-
-			/* buff is exactly the same as it was, except it has a bigger string buffer */
-		pfree(old_buffer);
-	}
-
-		/*add new info */
-	memcpy(buffer->string + buffer->length, str, strLength);
-	buffer->length += strLength;
-	buffer->string[buffer->length] = 0;/* force null-terminated */
-}
-
-
-/*
- * get new buffer size
- *  new size =    <big enough to put in the requested info> +
- *      10 +                                 -- just a little constant
- *      25% * <current buffer size>          -- exponential growth
- */
-int getSize(int buffer_size, int buffer_length, int strLength)
-{
-	/* extra space required in buffer */
-	int needed_extra = strLength - (buffer_size-buffer_length);
-
-	return buffer_size + needed_extra + DEFAULT_STR_LENGTH_PADDING + buffer_size*DEFAULT_PERCENT_SIZE_INCREASE;
-}
-

Deleted: trunk/lwgeom/stringBuffer.h
===================================================================
--- trunk/lwgeom/stringBuffer.h	2008-10-15 15:03:54 UTC (rev 3113)
+++ trunk/lwgeom/stringBuffer.h	2008-10-15 17:59:18 UTC (rev 3114)
@@ -1,14 +0,0 @@
-
-typedef struct {
-	char * string;
-	int length; /* length of string, EXCLUDING null termination */
-	int size;   /* size of buffer -can be longer than */
-} STRBUFF;
-
-
-extern STRBUFF * new_strBUFF(int size);
-extern void delete_StrBUFF(STRBUFF* buff);
-extern char* to_CString(STRBUFF * buffer);
-extern void add_str_simple(STRBUFF* buffer, char* str);
-extern void catenate(STRBUFF *buffer, char* str, int length);
-extern int getSize(int buffer_size, int buffer_length, int strLength);



More information about the postgis-commits mailing list