MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlParseComment

Function xmlParseComment

ThirdParty/libxml2/vtklibxml2/parser.c:5223–5362  ·  view source on GitHub ↗

* xmlParseComment: * @ctxt: an XML parser context * * DEPRECATED: Internal function, don't use. * * Parse an XML (SGML) comment. Always consumes '<!'. * * The spec says that "For compatibility, the string "--" (double-hyphen) * must not occur within comments. " * * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' */

Source from the content-addressed store, hash-verified

5221 * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
5222 */
5223void
5224xmlParseComment(xmlParserCtxtPtr ctxt) {
5225 xmlChar *buf = NULL;
5226 size_t size = XML_PARSER_BUFFER_SIZE;
5227 size_t len = 0;
5228 size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
5229 XML_MAX_HUGE_LENGTH :
5230 XML_MAX_TEXT_LENGTH;
5231 const xmlChar *in;
5232 size_t nbchar = 0;
5233 int ccol;
5234
5235 /*
5236 * Check that there is a comment right here.
5237 */
5238 if ((RAW != '<') || (NXT(1) != '!'))
5239 return;
5240 SKIP(2);
5241 if ((RAW != '-') || (NXT(1) != '-'))
5242 return;
5243 SKIP(2);
5244 GROW;
5245
5246 /*
5247 * Accelerated common case where input don't need to be
5248 * modified before passing it to the handler.
5249 */
5250 in = ctxt->input->cur;
5251 do {
5252 if (*in == 0xA) {
5253 do {
5254 ctxt->input->line++; ctxt->input->col = 1;
5255 in++;
5256 } while (*in == 0xA);
5257 }
5258get_more:
5259 ccol = ctxt->input->col;
5260 while (((*in > '-') && (*in <= 0x7F)) ||
5261 ((*in >= 0x20) && (*in < '-')) ||
5262 (*in == 0x09)) {
5263 in++;
5264 ccol++;
5265 }
5266 ctxt->input->col = ccol;
5267 if (*in == 0xA) {
5268 do {
5269 ctxt->input->line++; ctxt->input->col = 1;
5270 in++;
5271 } while (*in == 0xA);
5272 goto get_more;
5273 }
5274 nbchar = in - ctxt->input->cur;
5275 /*
5276 * save current set of data
5277 */
5278 if (nbchar > 0) {
5279 if (buf == NULL) {
5280 if ((*in == '-') && (in[1] == '-'))

Callers 4

xmlParseMarkupDeclFunction · 0.85
xmlParseContentInternalFunction · 0.85
xmlParseMiscFunction · 0.85
parser.cFile · 0.85

Calls 3

xmlErrMemoryFunction · 0.85
xmlParseCommentComplexFunction · 0.85
commentMethod · 0.80

Tested by

no test coverage detected