]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(sexp_iterator_init): Made this function static.
authorNiels Möller <nisse@lysator.liu.se>
Sun, 6 Oct 2002 19:12:36 +0000 (21:12 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Sun, 6 Oct 2002 19:12:36 +0000 (21:12 +0200)
(sexp_iterator_first): New, friendlier, initialization function.

Rev: src/nettle/sexp.c:1.5
Rev: src/nettle/sexp.h:1.4

sexp.c
sexp.h

diff --git a/sexp.c b/sexp.c
index 3c65354895a244e46a9b58dc78e72572bc2d8c3c..112b694bdd2c9325c949059b43110fec58c35d82 100644 (file)
--- a/sexp.c
+++ b/sexp.c
@@ -28,7 +28,9 @@
 #include <stdlib.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,
                   unsigned length, const uint8_t *input)
 {
@@ -46,6 +48,14 @@ sexp_iterator_init(struct sexp_iterator *iterator,
    * 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 NEXT(i) ((i)->buffer[(i)->pos++])
 
diff --git a/sexp.h b/sexp.h
index bf0d9adb5c9155fe7b55b7479ffc532f96d78675..151603777216fa3808d970ecdcda1365fb303a35 100644 (file)
--- a/sexp.h
+++ b/sexp.h
@@ -51,13 +51,13 @@ struct sexp_iterator
 };
 
 
-/* Initializes the iterator. You have to call next to get to the first
- * element. */
-void
-sexp_iterator_init(struct sexp_iterator *iterator,
-                  unsigned length, const uint8_t *input);
-
 /* All these functions return 1 on success, 0 on failure */
+
+/* Initializes the iterator. */
+int
+sexp_iterator_first(struct sexp_iterator *iterator,
+                   unsigned length, const uint8_t *input);
+
 int
 sexp_iterator_next(struct sexp_iterator *iterator);