From c6bebca3c76985016970d87e75dd025a169790b0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 20 Feb 2008 14:02:33 +0000 Subject: changed rsCStrDestruct() to use the new interface conventions --- stringbuf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'stringbuf.c') diff --git a/stringbuf.c b/stringbuf.c index 237355c0..3e222a5f 100755 --- a/stringbuf.c +++ b/stringbuf.c @@ -129,14 +129,19 @@ finalize_it: } -void rsCStrDestruct(rsCStrObj *pThis) +void rsCStrDestruct(rsCStrObj **ppThis) { + rsCStrObj *pThis = *ppThis; + /* rgerhards 2005-10-19: The free of pBuf was contained in conditional compilation. * The code was only compiled if STRINGBUF_TRIM_ALLOCSIZE was set to 1. I honestly * do not know why it was so, I think it was an artifact. Anyhow, I have changed this * now. Should there any issue occur, this comment hopefully will shed some light * on what happened. I re-verified, and this function has never before been called * by anyone. So changing it can have no impact for obvious reasons... + * + * rgerhards, 2008-02-20: I changed the interface to the new calling conventions, where + * the destructor receives a pointer to the object, so that it can set it to NULL. */ if(pThis->pBuf != NULL) { free(pThis->pBuf); @@ -147,6 +152,7 @@ void rsCStrDestruct(rsCStrObj *pThis) } RSFREEOBJ(pThis); + *ppThis = NULL; } -- cgit