From efef5cc4eda84847c7b87983eb99d77eb23d107f Mon Sep 17 00:00:00 2001
From: ellson <devnull@localhost>
Date: Sun, 19 Jun 2005 12:14:23 +0000
Subject: [PATCH] a few less reallocs

---
 lib/gvc/gvplugin.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c
index cf5ef9db7..6dc29293a 100644
--- a/lib/gvc/gvplugin.c
+++ b/lib/gvc/gvplugin.c
@@ -106,13 +106,19 @@ gvplugin_library_t *gvplugin_library_load(char *path)
     char *s, *sym;
     int len;
     static char *p;
+    static int lenp;
 
     char *suffix = "_LTX_library";
 
-    p = realloc(p,strlen(libdir)
-			+ 1
-			+ strlen(path)
-			+ 1);
+    len = strlen(libdir) + 1 + strlen(path) + 1;
+    if (len > lenp) {
+	lenp = len+20;
+	if (p)
+	    realloc(p, lenp);
+	else
+	    p = malloc(lenp);
+    }
+	
     if (path[0] == '/') {
 	strcpy(p, path);
     } else {
-- 
2.40.0