More string buffer functions
git-svn-id: svn://svn.cc65.org/cc65/trunk@2556 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2001-2002 Ullrich von Bassewitz */
|
/* (C) 2001-2003 Ullrich von Bassewitz */
|
||||||
/* R<>merstrasse 52 */
|
/* R<>merstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
@@ -283,3 +283,22 @@ void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Le
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void SB_Move (StrBuf* Target, StrBuf* Source)
|
||||||
|
/* Move the complete contents of Source to target. This will delete the old
|
||||||
|
* contents of Target, and Source will be empty after the call.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
/* Free the target string */
|
||||||
|
if (Target->Buf) {
|
||||||
|
xfree (Target->Buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Move all data from Source to Target */
|
||||||
|
*Target = *Source;
|
||||||
|
|
||||||
|
/* Clear Source */
|
||||||
|
InitStrBuf (Source);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2001-2002 Ullrich von Bassewitz */
|
/* (C) 2001-2003 Ullrich von Bassewitz */
|
||||||
/* R<>merstrasse 52 */
|
/* R<>merstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
@@ -225,7 +225,7 @@ INLINE char SB_LookAt (const StrBuf* B, unsigned Index)
|
|||||||
return (Index < B->Len)? B->Buf[Index] : '\0';
|
return (Index < B->Len)? B->Buf[Index] : '\0';
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define SB_Peek(B,Index) (((Index) < (B)->Len)? (B)->Buf[(Index)] : '\0')
|
# define SB_LookAt(B,Index) (((Index) < (B)->Len)? (B)->Buf[(Index)] : '\0')
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_INLINE)
|
#if defined(HAVE_INLINE)
|
||||||
@@ -338,6 +338,11 @@ void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Le
|
|||||||
* bytes.
|
* bytes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void SB_Move (StrBuf* Target, StrBuf* Source);
|
||||||
|
/* Move the complete contents of Source to target. This will delete the old
|
||||||
|
* contents of Target, and Source will be empty after the call.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of strbuf.h */
|
/* End of strbuf.h */
|
||||||
|
|||||||
Reference in New Issue
Block a user