StrBufReplaceToken() set the null terminator correctly master
authorArt Cancro <ajc@citadel.org>
Sat, 4 May 2024 23:26:31 +0000 (16:26 -0700)
committerArt Cancro <ajc@citadel.org>
Sat, 4 May 2024 23:26:31 +0000 (16:26 -0700)
libcitadel/lib/stringbuf.c

index b382025b957fc9d103d40877e1c30b835c56190b..92da0a931496ff3617b17e1bd3c26fda5a581169 100644 (file)
@@ -1,7 +1,6 @@
-// Copyright (c) 1987-2023 by the citadel.org team
+// Copyright (c) 1987-2024 by the citadel.org team
 //
 //
-// This program is open source software.  Use, duplication, or disclosure
-// is subject to the terms of the GNU General Public License, version 3.
+// This program is open source software.  Use, duplication, or disclosure is subject to the GNU General Public License, version 3.
 
 #define _GNU_SOURCE
 #include "sysdep.h"
 
 #define _GNU_SOURCE
 #include "sysdep.h"
@@ -164,19 +163,17 @@ void dbg_Init(StrBuf *Buf) {
 }
 
 #else
 }
 
 #else
-/* void it... */
+// void it...
 #define dbg_FreeStrBuf(a, b)
 #define dbg_IncreaseBuf(a)
 #define dbg_Init(a)
 
 #endif
 
 #define dbg_FreeStrBuf(a, b)
 #define dbg_IncreaseBuf(a)
 #define dbg_Init(a)
 
 #endif
 
-/*
- *  swaps the contents of two StrBufs
- * this is to be used to have cheap switched between a work-buffer and a target buffer 
- *  A First one
- *  B second one
- */
+// swaps the contents of two StrBufs
+// this is to be used to have cheap switched between a work-buffer and a target buffer 
+// A First one
+// B second one
 static inline void iSwapBuffers(StrBuf *A, StrBuf *B) {
        StrBuf C;
 
 static inline void iSwapBuffers(StrBuf *A, StrBuf *B) {
        StrBuf C;
 
@@ -192,15 +189,13 @@ void SwapBuffers(StrBuf *A, StrBuf *B) {
 }
 
 
 }
 
 
-/* 
- *  Cast operator to Plain String 
- * @note if the buffer is altered by StrBuf operations, this pointer may become 
- *  invalid. So don't lean on it after altering the buffer!
- *  Since this operation is considered cheap, rather call it often than risking
- *  your pointer to become invalid!
- *  Str the string we want to get the c-string representation for
- * @returns the Pointer to the Content. Don't mess with it!
- */
+// Cast operator to Plain String 
+// note: if the buffer is altered by StrBuf operations, this pointer may become 
+// invalid. So don't lean on it after altering the buffer!
+// Since this operation is considered cheap, rather call it often than risking
+// your pointer to become invalid!
+// Str the string we want to get the c-string representation for
+// returns the Pointer to the Content. Don't mess with it!
 inline const char *ChrPtr(const StrBuf *Str) {
        if (Str == NULL)
                return "";
 inline const char *ChrPtr(const StrBuf *Str) {
        if (Str == NULL)
                return "";
@@ -208,11 +203,9 @@ inline const char *ChrPtr(const StrBuf *Str) {
 }
 
 
 }
 
 
-/*
- *  since we know strlen()'s result, provide it here.
- *  Str the string to return the length to
- * @returns contentlength of the buffer
- */
+// since we know strlen()'s result, provide it here.
+// Str the string to return the length to
+// returns contentlength of the buffer
 inline int StrLength(const StrBuf *Str) {
        return (Str != NULL) ? Str->BufUsed : 0;
 }
 inline int StrLength(const StrBuf *Str) {
        return (Str != NULL) ? Str->BufUsed : 0;
 }
@@ -276,12 +269,10 @@ void ReAdjustEmptyBuf(StrBuf *Buf, long ThreshHold, long NewSize) {
 }
 
 
 }
 
 
-/*
- *  shrink long term buffers to their real size so they don't waste memory
- *  Buf buffer to shrink
- *  Force if not set, will just executed if the buffer is much to big; set for lifetime strings
- * @returns physical size of the buffer
- */
+// shrink long term buffers to their real size so they don't waste memory
+// Buf buffer to shrink
+// Force if not set, will just executed if the buffer is much to big; set for lifetime strings
+// returns physical size of the buffer
 long StrBufShrinkToFit(StrBuf *Buf, int Force) {
        if (Buf == NULL)
                return -1;
 long StrBufShrinkToFit(StrBuf *Buf, int Force) {
        if (Buf == NULL)
                return -1;
@@ -301,10 +292,8 @@ long StrBufShrinkToFit(StrBuf *Buf, int Force) {
 }
 
 
 }
 
 
-/*
- *  Allocate a new buffer with default buffer size
- * @returns the new stringbuffer
- */
+// Allocate a new buffer with default buffer size
+// returns the new stringbuffer
 StrBuf *NewStrBuf(void) {
        StrBuf *NewBuf;
 
 StrBuf *NewStrBuf(void) {
        StrBuf *NewBuf;
 
@@ -327,11 +316,9 @@ StrBuf *NewStrBuf(void) {
 }
 
 
 }
 
 
-/* 
- *  Copy Constructor; returns a duplicate of CopyMe
- *  CopyMe Buffer to faxmilate
- * @returns the new stringbuffer
- */
+// Copy Constructor; returns a duplicate of CopyMe
+// CopyMe Buffer to faxmilate
+// returns the new stringbuffer
 StrBuf *NewStrBufDup(const StrBuf *CopyMe) {
        StrBuf *NewBuf;
        
 StrBuf *NewStrBufDup(const StrBuf *CopyMe) {
        StrBuf *NewBuf;
        
@@ -359,14 +346,12 @@ StrBuf *NewStrBufDup(const StrBuf *CopyMe) {
 }
 
 
 }
 
 
-/* 
- *  Copy Constructor; CreateRelpaceMe will contain CopyFlushMe afterwards.
- *  NoMe if non-NULL, we will use that buffer as value; KeepOriginal will abused as len.
- *  CopyFlushMe Buffer to faxmilate if KeepOriginal, or to move into CreateRelpaceMe if !KeepOriginal.
- *  CreateRelpaceMe If NULL, will be created, else Flushed and filled CopyFlushMe 
- *  KeepOriginal should CopyFlushMe remain intact? or may we Steal its buffer?
- * @returns the new stringbuffer
- */
+// Copy Constructor; CreateRelpaceMe will contain CopyFlushMe afterwards.
+// NoMe if non-NULL, we will use that buffer as value; KeepOriginal will abused as len.
+// CopyFlushMe Buffer to faxmilate if KeepOriginal, or to move into CreateRelpaceMe if !KeepOriginal.
+// CreateRelpaceMe If NULL, will be created, else Flushed and filled CopyFlushMe 
+// KeepOriginal should CopyFlushMe remain intact? or may we Steal its buffer?
+// returns the new stringbuffer
 void NewStrBufDupAppendFlush(StrBuf **CreateRelpaceMe, StrBuf *CopyFlushMe, const char *NoMe, int KeepOriginal) {
        StrBuf *NewBuf;
        
 void NewStrBufDupAppendFlush(StrBuf **CreateRelpaceMe, StrBuf *CopyFlushMe, const char *NoMe, int KeepOriginal) {
        StrBuf *NewBuf;
        
@@ -389,11 +374,9 @@ void NewStrBufDupAppendFlush(StrBuf **CreateRelpaceMe, StrBuf *CopyFlushMe, cons
                return;
        }
 
                return;
        }
 
-       /* 
-        * Randomly Chosen: bigger than 64 chars is cheaper to swap the buffers instead of copying.
-        * else *CreateRelpaceMe may use more memory than needed in a longer term, CopyFlushMe might
-        * be a big IO-Buffer...
-        */
+       // Randomly Chosen: bigger than 64 chars is cheaper to swap the buffers instead of copying.
+       // else *CreateRelpaceMe may use more memory than needed in a longer term, CopyFlushMe might
+       // be a big IO-Buffer...
        if (KeepOriginal || (StrLength(CopyFlushMe) < 256)) {
                if (*CreateRelpaceMe == NULL) {
                        *CreateRelpaceMe = NewBuf = NewStrBufPlain(NULL, CopyFlushMe->BufUsed);
        if (KeepOriginal || (StrLength(CopyFlushMe) < 256)) {
                if (*CreateRelpaceMe == NULL) {
                        *CreateRelpaceMe = NewBuf = NewStrBufPlain(NULL, CopyFlushMe->BufUsed);
@@ -422,14 +405,12 @@ void NewStrBufDupAppendFlush(StrBuf **CreateRelpaceMe, StrBuf *CopyFlushMe, cons
 }
 
 
 }
 
 
-/*
- *  create a new Buffer using an existing c-string
- * this function should also be used if you want to pre-suggest
- * the buffer size to allocate in conjunction with ptr == NULL
- *  ptr the c-string to copy; may be NULL to create a blank instance
- *  nChars How many chars should we copy; -1 if we should measure the length ourselves
- * @returns the new stringbuffer
- */
+// create a new Buffer using an existing c-string
+// this function should also be used if you want to pre-suggest
+// the buffer size to allocate in conjunction with ptr == NULL
+// ptr the c-string to copy; may be NULL to create a blank instance
+// nChars How many chars should we copy; -1 if we should measure the length ourselves
+// returns the new stringbuffer
 StrBuf *NewStrBufPlain(const char* ptr, int nChars) {
        StrBuf *NewBuf;
        size_t Siz = BaseStrBufSize;
 StrBuf *NewStrBufPlain(const char* ptr, int nChars) {
        StrBuf *NewBuf;
        size_t Siz = BaseStrBufSize;
@@ -475,13 +456,13 @@ StrBuf *NewStrBufPlain(const char* ptr, int nChars) {
 }
 
 
 }
 
 
-/*
- *  Set an existing buffer from a c-string
- *  Buf buffer to load
- *  ptr c-string to put into 
- *  nChars set to -1 if we should work 0-terminated
- * @returns the new length of the string
- */
+//
+//  Set an existing buffer from a c-string
+//  Buf buffer to load
+//  ptr c-string to put into 
+//  nChars set to -1 if we should work 0-terminated
+// @returns the new length of the string
+///
 int StrBufPlain(StrBuf *Buf, const char* ptr, int nChars) {
        size_t Siz;
        size_t CopySize;
 int StrBufPlain(StrBuf *Buf, const char* ptr, int nChars) {
        size_t Siz;
        size_t CopySize;
@@ -518,13 +499,12 @@ int StrBufPlain(StrBuf *Buf, const char* ptr, int nChars) {
 }
 
 
 }
 
 
-/*
- *  use strbuf as wrapper for a string constant for easy handling
- *  StringConstant a string to wrap
- *  SizeOfStrConstant should be sizeof(StringConstant)-1
- */
-StrBuf* _NewConstStrBuf(const char* StringConstant, size_t SizeOfStrConstant)
-{
+//
+//  use strbuf as wrapper for a string constant for easy handling
+//  StringConstant a string to wrap
+//  SizeOfStrConstant should be sizeof(StringConstant)-1
+///
+StrBuf *_NewConstStrBuf(const char* StringConstant, size_t SizeOfStrConstant) {
        StrBuf *NewBuf;
 
        NewBuf = (StrBuf*) malloc(sizeof(StrBuf));
        StrBuf *NewBuf;
 
        NewBuf = (StrBuf*) malloc(sizeof(StrBuf));
@@ -541,10 +521,10 @@ StrBuf* _NewConstStrBuf(const char* StringConstant, size_t SizeOfStrConstant)
 }
 
 
 }
 
 
-/*
- *  flush the content of a Buf; keep its struct
- *  buf Buffer to flush
- */
+//
+//  flush the content of a Buf; keep its struct
+//  buf Buffer to flush
+///
 int FlushStrBuf(StrBuf *buf) {
        if ((buf == NULL) || (buf->buf == NULL)) {
                return -1;
 int FlushStrBuf(StrBuf *buf) {
        if ((buf == NULL) || (buf->buf == NULL)) {
                return -1;
@@ -557,12 +537,11 @@ int FlushStrBuf(StrBuf *buf) {
        return 0;
 }
 
        return 0;
 }
 
-/*
- *  wipe the content of a Buf thoroughly (overwrite it -> expensive); keep its struct
- *  buf Buffer to wipe
- */
-int FLUSHStrBuf(StrBuf *buf)
-{
+//
+//  wipe the content of a Buf thoroughly (overwrite it -> expensive); keep its struct
+//  buf Buffer to wipe
+///
+int FLUSHStrBuf(StrBuf *buf) {
        if (buf == NULL)
                return -1;
        if (buf->ConstBuf)
        if (buf == NULL)
                return -1;
        if (buf->ConstBuf)
@@ -577,14 +556,13 @@ int FLUSHStrBuf(StrBuf *buf)
 #ifdef SIZE_DEBUG
 int hFreeDbglog = -1;
 #endif
 #ifdef SIZE_DEBUG
 int hFreeDbglog = -1;
 #endif
-/*
- *  Release a Buffer
- * Its a double pointer, so it can NULL your pointer
- * so fancy SIG11 appear instead of random results
- *  FreeMe Pointer Pointer to the buffer to free
- */
-void FreeStrBuf (StrBuf **FreeMe)
-{
+//
+//  Release a Buffer
+// Its a double pointer, so it can NULL your pointer
+// so fancy SIG11 appear instead of random results
+//  FreeMe Pointer Pointer to the buffer to free
+///
+void FreeStrBuf (StrBuf **FreeMe) {
        if (*FreeMe == NULL)
                return;
 
        if (*FreeMe == NULL)
                return;
 
@@ -596,14 +574,14 @@ void FreeStrBuf (StrBuf **FreeMe)
        *FreeMe = NULL;
 }
 
        *FreeMe = NULL;
 }
 
-/*
- *  flatten a Buffer to the Char * we return 
- * Its a double pointer, so it can NULL your pointer
- * so fancy SIG11 appear instead of random results
- * The Callee then owns the buffer and is responsible for freeing it.
- *  SmashMe Pointer Pointer to the buffer to release Buf from and free
- * @returns the pointer of the buffer; Callee owns the memory thereafter.
- */
+//
+//  flatten a Buffer to the Char * we return 
+// Its a double pointer, so it can NULL your pointer
+// so fancy SIG11 appear instead of random results
+// The Callee then owns the buffer and is responsible for freeing it.
+//  SmashMe Pointer Pointer to the buffer to release Buf from and free
+// @returns the pointer of the buffer; Callee owns the memory thereafter.
+///
 char *SmashStrBuf (StrBuf **SmashMe) {
        char *Ret;
 
 char *SmashStrBuf (StrBuf **SmashMe) {
        char *Ret;
 
@@ -619,11 +597,9 @@ char *SmashStrBuf (StrBuf **SmashMe) {
 }
 
 
 }
 
 
-/*
- *  Release the buffer
- * If you want put your StrBuf into a Hash, use this as Destructor.
- *  VFreeMe untyped pointer to a StrBuf. be shure to do the right thing [TM]
- */
+// Release the buffer
+// If you want put your StrBuf into a Hash, use this as Destructor.
+// VFreeMe untyped pointer to a StrBuf. be shure to do the right thing [TM]
 void HFreeStrBuf (void *VFreeMe) {
        StrBuf *FreeMe = (StrBuf*)VFreeMe;
        if (FreeMe == NULL)
 void HFreeStrBuf (void *VFreeMe) {
        StrBuf *FreeMe = (StrBuf*)VFreeMe;
        if (FreeMe == NULL)
@@ -637,11 +613,11 @@ void HFreeStrBuf (void *VFreeMe) {
 }
 
 
 }
 
 
-/*******************************************************************************
- *                      Simple string transformations                          *
- *******************************************************************************/
+//******************************************************************************
+//                      Simple string transformations                          *
+//******************************************************************************/
 
 
-//  Wrapper around atol
+// Wrapper around atol
 long StrTol(const StrBuf *Buf) {
        if (Buf == NULL)
                return 0;
 long StrTol(const StrBuf *Buf) {
        if (Buf == NULL)
                return 0;
@@ -652,7 +628,7 @@ long StrTol(const StrBuf *Buf) {
 }
 
 
 }
 
 
-//  Wrapper around atoi
+// Wrapper around atoi
 int StrToi(const StrBuf *Buf) {
        if (Buf == NULL)
                return 0;
 int StrToi(const StrBuf *Buf) {
        if (Buf == NULL)
                return 0;
@@ -921,13 +897,10 @@ int StrBufSub(StrBuf *dest, const StrBuf *Source, unsigned long Offset, size_t n
        return NCharsRemain;
 }
 
        return NCharsRemain;
 }
 
-/**
- *  Cut nChars from the start of the string
- *  Buf Buffer to modify
- *  nChars how many chars should be skipped?
- */
-void StrBufCutLeft(StrBuf *Buf, int nChars)
-{
+//  Cut nChars from the start of the string
+//  Buf Buffer to modify
+//  nChars how many chars should be skipped?
+void StrBufCutLeft(StrBuf *Buf, int nChars) {
        if ((Buf == NULL) || (Buf->BufUsed == 0)) return;
        if (nChars >= Buf->BufUsed) {
                FlushStrBuf(Buf);
        if ((Buf == NULL) || (Buf->BufUsed == 0)) return;
        if (nChars >= Buf->BufUsed) {
                FlushStrBuf(Buf);
@@ -938,13 +911,10 @@ void StrBufCutLeft(StrBuf *Buf, int nChars)
        Buf->buf[Buf->BufUsed] = '\0';
 }
 
        Buf->buf[Buf->BufUsed] = '\0';
 }
 
-/**
- *  Cut the trailing n Chars from the string
- *  Buf Buffer to modify
- *  nChars how many chars should be trunkated?
- */
-void StrBufCutRight(StrBuf *Buf, int nChars)
-{
+// Cut the trailing n Chars from the string
+// Buf Buffer to modify
+// nChars how many chars should be trunkated?
+void StrBufCutRight(StrBuf *Buf, int nChars) {
        if ((Buf == NULL) || (Buf->BufUsed == 0) || (Buf->buf == NULL))
                return;
 
        if ((Buf == NULL) || (Buf->BufUsed == 0) || (Buf->buf == NULL))
                return;
 
@@ -956,12 +926,12 @@ void StrBufCutRight(StrBuf *Buf, int nChars)
        Buf->buf[Buf->BufUsed] = '\0';
 }
 
        Buf->buf[Buf->BufUsed] = '\0';
 }
 
-/**
- *  Cut the string after n Chars
- *  Buf Buffer to modify
- *  AfternChars after how many chars should we trunkate the string?
- *  At if non-null and points inside of our string, cut it there.
- */
+//*
+//  Cut the string after n Chars
+//  Buf Buffer to modify
+//  AfternChars after how many chars should we trunkate the string?
+//  At if non-null and points inside of our string, cut it there.
+///
 void StrBufCutAt(StrBuf *Buf, int AfternChars, const char *At)
 {
        if ((Buf == NULL) || (Buf->BufUsed == 0)) return;
 void StrBufCutAt(StrBuf *Buf, int AfternChars, const char *At)
 {
        if ((Buf == NULL) || (Buf->BufUsed == 0)) return;
@@ -976,10 +946,10 @@ void StrBufCutAt(StrBuf *Buf, int AfternChars, const char *At)
 }
 
 
 }
 
 
-/**
- *  Strip leading and trailing spaces from a string; with premeasured and adjusted length.
- *  Buf the string to modify
- */
+//*
+//  Strip leading and trailing spaces from a string; with premeasured and adjusted length.
+//  Buf the string to modify
+///
 void StrBufTrim(StrBuf *Buf)
 {
        int delta = 0;
 void StrBufTrim(StrBuf *Buf)
 {
        int delta = 0;
@@ -997,10 +967,10 @@ void StrBufTrim(StrBuf *Buf)
        }
        if (delta > 0) StrBufCutLeft(Buf, delta);
 }
        }
        if (delta > 0) StrBufCutLeft(Buf, delta);
 }
-/**
- *  changes all spaces in the string  (tab, linefeed...) to Blank (0x20)
- *  Buf the string to modify
- */
+//*
+//  changes all spaces in the string  (tab, linefeed...) to Blank (0x20)
+//  Buf the string to modify
+///
 void StrBufSpaceToBlank(StrBuf *Buf)
 {
        char *pche, *pch;
 void StrBufSpaceToBlank(StrBuf *Buf)
 {
        char *pche, *pch;
@@ -1038,10 +1008,10 @@ void StrBufStripAllBut(StrBuf *Buf, char leftboundary, char rightboundary)
 }
 
 
 }
 
 
-/**
- *  uppercase the contents of a buffer
- *  Buf the buffer to translate
- */
+//*
+//  uppercase the contents of a buffer
+//  Buf the buffer to translate
+///
 void StrBufUpCase(StrBuf *Buf) 
 {
        char *pch, *pche;
 void StrBufUpCase(StrBuf *Buf) 
 {
        char *pch, *pche;
@@ -1057,10 +1027,10 @@ void StrBufUpCase(StrBuf *Buf)
 }
 
 
 }
 
 
-/**
- *  lowercase the contents of a buffer
- *  Buf the buffer to translate
- */
+//*
+//  lowercase the contents of a buffer
+//  Buf the buffer to translate
+///
 void StrBufLowerCase(StrBuf *Buf) 
 {
        char *pch, *pche;
 void StrBufLowerCase(StrBuf *Buf) 
 {
        char *pch, *pche;
@@ -1076,19 +1046,19 @@ void StrBufLowerCase(StrBuf *Buf)
 }
 
 
 }
 
 
-/*******************************************************************************
- *           a tokenizer that kills, maims, and destroys                       *
- *******************************************************************************/
+//******************************************************************************
+//           a tokenizer that kills, maims, and destroys                       *
+//******************************************************************************/
 
 
-/**
- *  Replace a token at a given place with a given length by another token with given length
- *  Buf String where to work on
- *  where where inside of the Buf is the search-token
- *  HowLong How long is the token to be replaced
- *  Repl Token to insert at 'where'
- *  ReplLen Length of repl
- * @returns -1 if fail else length of resulting Buf
- */
+//*
+//  Replace a token at a given place with a given length by another token with given length
+//  Buf String where to work on
+//  where where inside of the Buf is the search-token
+//  HowLong How long is the token to be replaced
+//  Repl Token to insert at 'where'
+//  ReplLen Length of repl
+// @returns -1 if fail else length of resulting Buf
+///
 int StrBufReplaceToken(StrBuf *Buf, long where, long HowLong, const char *Repl, long ReplLen) {
 
        if ((Buf == NULL) || (where > Buf->BufUsed) || (where + HowLong > Buf->BufUsed)) {
 int StrBufReplaceToken(StrBuf *Buf, long where, long HowLong, const char *Repl, long ReplLen) {
 
        if ((Buf == NULL) || (where > Buf->BufUsed) || (where + HowLong > Buf->BufUsed)) {
@@ -1104,15 +1074,16 @@ int StrBufReplaceToken(StrBuf *Buf, long where, long HowLong, const char *Repl,
        memmove(Buf->buf + where + ReplLen, Buf->buf + where + HowLong, Buf->BufUsed - where - HowLong);
        memcpy(Buf->buf + where, Repl, ReplLen);
        Buf->BufUsed += ReplLen - HowLong;
        memmove(Buf->buf + where + ReplLen, Buf->buf + where + HowLong, Buf->BufUsed - where - HowLong);
        memcpy(Buf->buf + where, Repl, ReplLen);
        Buf->BufUsed += ReplLen - HowLong;
+       Buf->buf[Buf->BufUsed] = 0;
        return Buf->BufUsed;
 }
 
        return Buf->BufUsed;
 }
 
-/**
- *  Counts the numbmer of tokens in a buffer
- *  source String to count tokens in
- *  tok    Tokenizer char to count
- * @returns numbers of tokenizer chars found
- */
+//*
+//  Counts the numbmer of tokens in a buffer
+//  source String to count tokens in
+//  tok    Tokenizer char to count
+// @returns numbers of tokenizer chars found
+///
 int StrBufNum_tokens(const StrBuf *source, char tok) {
        char *pch, *pche;
        long NTokens;
 int StrBufNum_tokens(const StrBuf *source, char tok) {
        char *pch, *pche;
        long NTokens;
@@ -1132,13 +1103,13 @@ int StrBufNum_tokens(const StrBuf *source, char tok) {
        return NTokens;
 }
 
        return NTokens;
 }
 
-/**
- *  a string tokenizer
- *  Source StringBuffer to read into
- *  parmnum n'th Parameter to remove
- *  separator tokenizer character
- * @returns -1 if not found, else length of token.
- */
+//*
+//  a string tokenizer
+//  Source StringBuffer to read into
+//  parmnum n'th Parameter to remove
+//  separator tokenizer character
+// @returns -1 if not found, else length of token.
+///
 int StrBufRemove_token(StrBuf *Source, int parmnum, char separator)
 {
        int ReducedBy;
 int StrBufRemove_token(StrBuf *Source, int parmnum, char separator)
 {
        int ReducedBy;
@@ -1215,19 +1186,19 @@ int StrBufExtract_tokenFromStr(StrBuf *dest, const char *Source, long SourceLen,
        return StrBufExtract_token(dest, &Temp, parmnum, separator);
 }
 
        return StrBufExtract_token(dest, &Temp, parmnum, separator);
 }
 
-/**
- *  a string tokenizer
- *  dest Destination StringBuffer
- *  Source StringBuffer to read into
- *  parmnum n'th Parameter to extract
- *  separator tokenizer character
- * @returns -1 if not found, else length of token.
- */
+//*
+//  a string tokenizer
+//  dest Destination StringBuffer
+//  Source StringBuffer to read into
+//  parmnum n'th Parameter to extract
+//  separator tokenizer character
+// @returns -1 if not found, else length of token.
+///
 int StrBufExtract_token(StrBuf *dest, const StrBuf *Source, int parmnum, char separator)
 {
 int StrBufExtract_token(StrBuf *dest, const StrBuf *Source, int parmnum, char separator)
 {
-       const char *s, *e;              //* source * /
-       int len = 0;                    //* running total length of extracted string * /
-       int current_token = 0;          //* token currently being processed * /
+       const char *s, *e;              // source
+       int len = 0;                    // running total length of extracted string
+       int current_token = 0;          // token currently being processed
         
        if (dest != NULL) {
                dest->buf[0] = '\0';
         
        if (dest != NULL) {
                dest->buf[0] = '\0';