Index: trunk/psLib/src/sys/psString.c
===================================================================
--- trunk/psLib/src/sys/psString.c	(revision 29931)
+++ trunk/psLib/src/sys/psString.c	(revision 29932)
@@ -48,4 +48,21 @@
     psString string = p_psAlloc(file, lineno, func, nChar + 1);
     psMemSetDeallocator(string, (psFreeFunc)stringFree);
+
+    return string;
+}
+
+
+psString p_psStringRealloc(const char *file,
+			   unsigned int lineno,
+			   const char *func,
+			   psString string,
+			   size_t nChar)
+{
+    if (!string) {
+	string = p_psAlloc(file, lineno, func, nChar + 1);
+	psMemSetDeallocator(string, (psFreeFunc)stringFree);
+    } else {
+        string = p_psRealloc(file, lineno, func, string, nChar + 1);
+    }
 
     return string;
Index: trunk/psLib/src/sys/psString.h
===================================================================
--- trunk/psLib/src/sys/psString.h	(revision 29931)
+++ trunk/psLib/src/sys/psString.h	(revision 29932)
@@ -40,5 +40,4 @@
 #define PS_FILE_LINE p_psFileLine(__FILE__,__LINE__)
 
-
 /** Allocates a new psString.
  *
@@ -60,4 +59,24 @@
 #endif // ifdef DOXYGEN
 
+/** Reallocate an existing psString (or alloc if not existent)
+ *
+ *  @return psString:       string of length n.
+ */
+#ifdef DOXYGEN
+psString psStringRealloc(
+    psString string,
+    size_t nChar                        ///< Size of psString to allocate.
+);
+#else // ifdef DOXYGEN
+psString p_psStringRealloc(
+    const char *file,                   ///< File of caller
+    unsigned int lineno,                ///< Line number of caller
+    const char *func,                   ///< Function name of caller
+    psString string,			///< supplied string or NULL
+    size_t nChar                        ///< Size of psString to allocate.
+) PS_ATTR_MALLOC;
+#define psStringRealloc(string, nChar)				\
+    p_psStringRealloc(__FILE__, __LINE__, __func__, string, nChar)
+#endif // ifdef DOXYGEN
 
 /** Checks the type of a particular pointer.
