Commit 874d2594 authored by Niels Möller's avatar Niels Möller
Browse files

* src/parse.c (parse_atoms): New function.

(parse_atom_list): Read length field first, so that callers don't
have to call parse_sub_buffer() manually.

Rev: src/parse.c:1.25
Rev: src/parse.h:1.18
parent 9383032f
......@@ -242,7 +242,7 @@ int parse_next_atom(struct simple_buffer *buffer, int *result)
return 1;
}
struct int_list *parse_atom_list(struct simple_buffer *buffer, unsigned limit)
struct int_list *parse_atoms(struct simple_buffer *buffer, unsigned limit)
{
unsigned count;
unsigned i;
......@@ -278,6 +278,16 @@ struct int_list *parse_atom_list(struct simple_buffer *buffer, unsigned limit)
return res;
}
struct int_list *parse_atom_list(struct simple_buffer *buffer, unsigned limit)
{
struct simple_buffer sub_buffer;
if (!parse_sub_buffer(buffer, &sub_buffer))
return NULL;
return parse_atoms(&sub_buffer, limit);
}
/* Returns success (i.e. 1) iff there is no data left */
int parse_eod(struct simple_buffer *buffer)
{
......
......@@ -77,6 +77,11 @@ int parse_atom(struct simple_buffer *buffer, int *result);
* Unknown atoms sets result to zero. */
int parse_next_atom(struct simple_buffer *buffer, int *result);
/* Reads a list of atoms. The buffer should hold the list body; the
* length field should already be stripped off (usually by
* parse_sub_buffer()). */
struct int_list *parse_atoms(struct simple_buffer *buffer, unsigned limit);
/* Creates a list of integers. The 0 atom means an unknown atom was
* read. Returns a NULL pointer on error. */
struct int_list *parse_atom_list(struct simple_buffer *buffer, unsigned limit);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment