Fix C comment stripping when the comment contains *

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11788 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-12-19 11:23:20 +00:00
commit 9e2f8265b2

View file

@ -88,8 +88,8 @@ void Swig_banner_target_lang(File *f, const_String_or_char_ptr commentchar) {
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Swig_strip_c_comments() * Swig_strip_c_comments()
* *
* Return a new string with C comments stripped from the input string. Null is * Return a new string with C comments stripped from the input string. NULL is
* returned if there aren't any. * returned if there aren't any comments.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
String *Swig_strip_c_comments(const String *s) { String *Swig_strip_c_comments(const String *s) {
@ -107,9 +107,10 @@ String *Swig_strip_c_comments(const String *s) {
comment_begin = c-1; comment_begin = c-1;
} else if (comment_begin && !comment_end && *c == '*') { } else if (comment_begin && !comment_end && *c == '*') {
++c; ++c;
if (*c == '/') if (*c == '/') {
comment_end = c; comment_end = c;
break; break;
}
} }
++c; ++c;
} }