diff options
| -rw-r--r-- | doc/ScintillaHistory.html | 1 | ||||
| -rw-r--r-- | include/SString.h | 17 | ||||
| -rw-r--r-- | src/PropSet.cxx | 13 | 
3 files changed, 29 insertions, 2 deletions
| diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 22aaef54a..4b0ed96d9 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -167,6 +167,7 @@  	<li>Reinhold Niesner</li>  	<li>Jos van der Zande</li>  	<li>Pescuma</li> +	<li>Pavol Bosik</li>      </ul>      <p>         Images used in GTK+ version diff --git a/include/SString.h b/include/SString.h index 3efb84a03..960945dbc 100644 --- a/include/SString.h +++ b/include/SString.h @@ -109,6 +109,18 @@ public:  	const char *c_str() const {  		return s ? s : "";  	} +	/** Attach to a string allocated by means of StringAlloc(len). */ +	SString &attach(char *s_, lenpos_t sLen_ = measure_length, lenpos_t sSize_ = measure_length) { +		delete []s; +		s = s_; +		if (!s) { +			sLen = sSize = 0; +		} else { +			sLen = (sLen_ == measure_length ? strlen(s) : sLen_); +			sSize = (sSize_ == measure_length ? sLen + 1 : sSize_); +		} +		return *this; +	}  	/** Give ownership of buffer to caller which must use delete[] to free buffer. */  	char *detach() {  		char *sRet = s; @@ -175,6 +187,11 @@ public:  	static char *StringAllocate(  		const char *s,			///< The string to duplicate  		lenpos_t len=measure_length);	///< The length of memory to allocate. Optional. +	/** +	 * Allocate uninitialized memory big enough to fit a string of the given length +	 * @return the pointer to the new string +	 */ +	static char *StringAllocate(lenpos_t len);  };  /** diff --git a/src/PropSet.cxx b/src/PropSet.cxx index 32ec59626..70cd46f88 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -325,9 +325,18 @@ char *SString::StringAllocate(  	return sNew;  } -// End SString functions - +/** + * Allocate uninitialized memory big enough to fit a string of the given length + * @return the pointer to the new string + */ +char *SString::StringAllocate(lenpos_t len) { +	if (len != measure_length) +		return new char [len + 1]; +	else +		return 0; +} +// End SString functions  PropSet::PropSet() {  	superPS = 0; | 
