From e623c87d63b458079ea66c3ef41080f7cb52c2ad Mon Sep 17 00:00:00 2001 From: uz Date: Sat, 10 Oct 2009 20:51:52 +0000 Subject: [PATCH] New function SB_SkipMultiple(). git-svn-id: svn://svn.cc65.org/cc65/trunk@4358 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/common/strbuf.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/common/strbuf.h b/src/common/strbuf.h index fc904a1d2..8e3fc8863 100644 --- a/src/common/strbuf.h +++ b/src/common/strbuf.h @@ -286,6 +286,18 @@ INLINE void SB_Skip (StrBuf* B) # define SB_Skip(B) do { if ((B)->Index < (B)->Len) ++(B)->Index; } while (0) #endif +#if defined(HAVE_INLINE) +INLINE void SB_SkipMultiple (StrBuf* B, unsigned Count) +/* Skip a number of characters in the string buffer if this is possible. */ +{ + if ((B->Index += Count) > B->Len) { + B->Index = B->Len; + } +} +#else +# define SB_SkipMultiple(B) do { if (((B)->Index += (Count)) > (B)->Len) (B)->Index = (B)->Len; } while (0) +#endif + void SB_Drop (StrBuf* B, unsigned Count); /* Drop characters from the end of the string. */ -- 2.39.5