From: cuz Date: Sun, 29 Sep 2002 19:55:38 +0000 (+0000) Subject: New function SB_Skip X-Git-Tag: V2.12.0~2218 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=092f10862e01a9e9e8a7a1b074da9e47190a80a6;p=cc65 New function SB_Skip git-svn-id: svn://svn.cc65.org/cc65/trunk@1412 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/common/strbuf.h b/src/common/strbuf.h index 36120c527..3ab71df60 100644 --- a/src/common/strbuf.h +++ b/src/common/strbuf.h @@ -191,7 +191,7 @@ INLINE char SB_Get (StrBuf* B) #if defined(HAVE_INLINE) INLINE char SB_Peek (StrBuf* B) -/* Look at the next character from the string without incrementing Index. +/* Look at the next character from the string without incrementing Index. * Returns NUL if the end of the string is reached. */ { @@ -201,6 +201,18 @@ INLINE char SB_Peek (StrBuf* B) # define SB_Peek(B) (((B)->Index < (B)->Len)? (B)->Buf[(B)->Index] : '\0') #endif +#if defined(HAVE_INLINE) +INLINE void SB_Skip (StrBuf* B) +/* Skip the next character in the string buffer if this is possible. */ +{ + if (B->Index < B->Len) { + ++B->Index; + } +} +#else +# define SB_Skip(B) do { if ((B)->Index < (B)->Len) ++(B)->Index; } while (0) +#endif + void SB_Terminate (StrBuf* B); /* Zero terminate the given string buffer. NOTE: The terminating zero is not * accounted for in B->Len, if you want that, you have to use AppendChar!