1 /*
2  * Copyright (C) 2018 Alexander Borisov
3  *
4  * Author: Alexander Borisov <borisov@lexbor.com>
5  */
6 
7 #include "lexbor/html/tokenizer/error.h"
8 
9 
10 lxb_html_tokenizer_error_t *
lxb_html_tokenizer_error_add(lexbor_array_obj_t * parse_errors,const lxb_char_t * pos,lxb_html_tokenizer_error_id_t id)11 lxb_html_tokenizer_error_add(lexbor_array_obj_t *parse_errors,
12                              const lxb_char_t *pos,
13                              lxb_html_tokenizer_error_id_t id)
14 {
15     if (parse_errors == NULL) {
16         return NULL;
17     }
18 
19     lxb_html_tokenizer_error_t *entry = lexbor_array_obj_push(parse_errors);
20     if (entry == NULL) {
21         return NULL;
22     }
23 
24     entry->id = id;
25     entry->pos = pos;
26 
27     return entry;
28 }
29