* 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 - '-')))* '-->' */
| 5221 | * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' |
| 5222 | */ |
| 5223 | void |
| 5224 | xmlParseComment(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 | } |
| 5258 | get_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] == '-')) |
no test coverage detected