diff options
author | Niels Möller <nisse@lysator.liu.se> | 2002-11-10 14:38:50 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2002-11-10 14:38:50 +0100 |
commit | 1343434e1c21f1ad4441339d1b8a30d2ffe9c268 (patch) | |
tree | 25444ee886799180b952894ab194217b8e05e436 /sexp.c | |
parent | a8ff180596b0f16837bc08cf493c0f9224c6233f (diff) | |
download | nettle-1343434e1c21f1ad4441339d1b8a30d2ffe9c268.tar.gz |
* sexp.h (struct sexp_iterator): New field start.
* sexp.c (sexp_iterator_subexpr): New function.
(sexp_iterator_parse): Initialize ITERATOR->start.
Rev: src/nettle/sexp.c:1.11
Rev: src/nettle/sexp.h:1.8
Diffstat (limited to 'sexp.c')
-rw-r--r-- | sexp.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -99,6 +99,8 @@ sexp_iterator_simple(struct sexp_iterator *iterator, static int sexp_iterator_parse(struct sexp_iterator *iterator) { + iterator->start = iterator->pos; + if (EMPTY(iterator)) { if (iterator->level) @@ -208,6 +210,19 @@ sexp_iterator_exit_list(struct sexp_iterator *iterator) return sexp_iterator_parse(iterator); } +const uint8_t * +sexp_iterator_subexpr(struct sexp_iterator *iterator, + unsigned *length) +{ + unsigned start = iterator->start; + if (!sexp_iterator_next(iterator)) + return 0; + + *length = iterator->start - start; + return iterator->buffer + start; +} + + int sexp_iterator_check_type(struct sexp_iterator *iterator, const uint8_t *type) |