Skip to content
Snippets Groups Projects
Commit d91e8faf authored by Niels Möller's avatar Niels Möller
Browse files

(sexp_iterator_init): Made this function static.

(sexp_iterator_first): New, friendlier, initialization function.

Rev: src/nettle/sexp.c:1.5
Rev: src/nettle/sexp.h:1.4
parent 4e2be895
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
void /* Initializes the iterator. You have to call next to get to the first
* element. */
static void
sexp_iterator_init(struct sexp_iterator *iterator, sexp_iterator_init(struct sexp_iterator *iterator,
unsigned length, const uint8_t *input) unsigned length, const uint8_t *input)
{ {
...@@ -46,6 +48,14 @@ sexp_iterator_init(struct sexp_iterator *iterator, ...@@ -46,6 +48,14 @@ sexp_iterator_init(struct sexp_iterator *iterator,
* skip white space here. */ * skip white space here. */
} }
int
sexp_iterator_first(struct sexp_iterator *iterator,
unsigned length, const uint8_t *input)
{
sexp_iterator_init(iterator, length, input);
return sexp_iterator_next(iterator);
}
#define EMPTY(i) ((i)->pos == (i)->length) #define EMPTY(i) ((i)->pos == (i)->length)
#define NEXT(i) ((i)->buffer[(i)->pos++]) #define NEXT(i) ((i)->buffer[(i)->pos++])
......
...@@ -51,13 +51,13 @@ struct sexp_iterator ...@@ -51,13 +51,13 @@ struct sexp_iterator
}; };
/* Initializes the iterator. You have to call next to get to the first /* All these functions return 1 on success, 0 on failure */
* element. */
void /* Initializes the iterator. */
sexp_iterator_init(struct sexp_iterator *iterator, int
sexp_iterator_first(struct sexp_iterator *iterator,
unsigned length, const uint8_t *input); unsigned length, const uint8_t *input);
/* All these functions return 1 on success, 0 on failure */
int int
sexp_iterator_next(struct sexp_iterator *iterator); sexp_iterator_next(struct sexp_iterator *iterator);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment