diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-26 14:22:00 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-26 14:22:00 +0200 |
commit | 1f361c5eb9028e7750a1c84811c9c3ac5cdd0a31 (patch) | |
tree | 3856e590007aeb16bc251bd2256b55669113fd52 /runtime/stringbuf.c | |
parent | 6be06d50e328c4b8c79b263e176e6b4e384a03f9 (diff) | |
download | rsyslog-1f361c5eb9028e7750a1c84811c9c3ac5cdd0a31.tar.gz rsyslog-1f361c5eb9028e7750a1c84811c9c3ac5cdd0a31.tar.xz rsyslog-1f361c5eb9028e7750a1c84811c9c3ac5cdd0a31.zip |
some optimization, declared some frequently called small stringbuf functions inline
Diffstat (limited to 'runtime/stringbuf.c')
-rw-r--r-- | runtime/stringbuf.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c index f3824831..88f5a3a2 100644 --- a/runtime/stringbuf.c +++ b/runtime/stringbuf.c @@ -343,42 +343,6 @@ uchar* rsCStrGetSzStr(cstr_t *pThis) } -/* Converts the CStr object to a classical sz string and returns that. - * Same restrictions as in cstrGetSzStr() applies (see there!). This - * function here guarantees that a valid string is returned, even if - * the CStr object currently holds a NULL pointer string buffer. If so, - * "" is returned. - * rgerhards 2005-10-19 - * WARNING: The returned pointer MUST NOT be freed, as it may be - * obtained from that constant memory pool (in case of NULL!) - */ -uchar* cstrGetSzStrNoNULL(cstr_t *pThis) -{ - rsCHECKVALIDOBJECT(pThis, OIDrsCStr); - if(pThis->pBuf == NULL) - return (uchar*) ""; - else - return cstrGetSzStr(pThis); -} - -/* Returns the cstr data as a classical C sz string. We use that the - * Finalizer did properly terminate our string (but we may stil be NULL). - * So it is vital that the finalizer is called BEFORe this function here! - * The caller must not free or otherwise manipulate the returned string and must not - * destroy the CStr object as long as the ascii string is used. - * This function may return NULL, if the string is currently NULL. This - * is a feature, not a bug. If you need non-NULL in any case, use - * cstrGetSzStrNoNULL() instead. - * Note that due to the new single-buffer interface this function almost does nothing! - * rgerhards, 2006-09-16 - */ -uchar* cstrGetSzStr(cstr_t *pThis) -{ - rsCHECKVALIDOBJECT(pThis, OIDrsCStr); - return(pThis->pBuf); -} - - /* Converts the CStr object to a classical zero-terminated C string, * returns that string and destroys the CStr object. The returned string * MUST be freed by the caller. The function might return NULL if @@ -426,27 +390,6 @@ finalize_it: } -/* Finalize the string object. This must be called after all data is added to it - * but before that data is used. - * rgerhards, 2009-06-16 - */ -rsRetVal -cstrFinalize(cstr_t *pThis) -{ - DEFiRet; - rsCHECKVALIDOBJECT(pThis, OIDrsCStr); - - if(pThis->iStrLen > 0) { - /* terminate string only if one exists */ - CHKiRet(cstrAppendChar(pThis, '\0')); - --pThis->iStrLen; /* do NOT count the \0 byte */ - } - -finalize_it: - RETiRet; -} - - /* return the length of the current string * 2005-09-09 rgerhards * Please note: this is only a function in a debug build. |