BOOL next_node(stream_t *stream, strbuf_t *buf) { strbuf_t tmpbuf; /* search through the end of the current node */ strbuf_init(&tmpbuf); if(!find_node_end(stream, &tmpbuf)) { strbuf_free(&tmpbuf); return FALSE; } strbuf_free(&tmpbuf); /* find the beginning of the next node */ if(!stream_chr(stream, NULL, '<')) return FALSE; /* read out the data of the next node */ if(!find_node_end(stream, buf)) return FALSE; strbuf_append(buf, ">", 2); return TRUE; }
BOOL next_node(stream_t *stream, strbuf_t *buf) { /* find the beginning of the next node */ if(!stream_chr(stream, NULL, '<')) return FALSE; /* read out the data of the next node */ if(!find_node_end(stream, buf)) return FALSE; strbuf_append(buf, ">", 2); return TRUE; }