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

* parse.c (parse_atom_list): New limit argument; longer lists will

return NULL. Signedness fixes (

Rev: src/parse.c:1.20
parent d8ce7b85
......@@ -30,6 +30,8 @@
#include "werror.h"
#include "xalloc.h"
#include <string.h>
void simple_buffer_init(struct simple_buffer *buffer,
UINT32 capacity, UINT8 *data)
......@@ -241,16 +243,22 @@ int parse_next_atom(struct simple_buffer *buffer, int *result)
return 1;
struct int_list *parse_atom_list(struct simple_buffer *buffer)
struct int_list *parse_atom_list(struct simple_buffer *buffer, unsigned limit)
int count;
int i;
unsigned count;
unsigned i;
struct int_list *res;
/* Count commas (no commas means one atom) */
for (i = buffer->pos, count = 1; i < buffer->capacity; i++)
if (buffer->data[i] == ',')
if (count >= limit)
return NULL;
res = alloc_int_list(count);
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