From 76540e7ffa010351d43e2717aaf755863284c807 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 4 Dec 1998 08:19:28 +0000 Subject: [PATCH] prof_get.c: Add new public profile_iterator functions for iterating over values found in the profile file. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11062 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/profile/ChangeLog | 5 +++++ src/util/profile/prof_get.c | 28 ++++++++++++++++++++++++++++ src/util/profile/prof_int.h | 13 +++++++++++-- src/util/profile/prof_tree.c | 2 -- src/util/profile/profile.hin | 19 ++++++++++++++++++- 5 files changed, 62 insertions(+), 5 deletions(-) diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index a0a48dad3..554357a58 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,8 @@ +1998-12-04 Theodore Ts'o + + * prof_get.c: Add new public profile_iterator functions for + iterating over values found in the profile file. + 1998-11-17 Theodore Ts'o * prof_get.c (profile_get_values): If there are no relations diff --git a/src/util/profile/prof_get.c b/src/util/profile/prof_get.c index 7f1d3c5ce..ff07bc3ef 100644 --- a/src/util/profile/prof_get.c +++ b/src/util/profile/prof_get.c @@ -344,3 +344,31 @@ cleanup: end_list(&values, 0); return retval; } + +errcode_t profile_iterator_create(profile, names, flags, ret_iter) + profile_t profile; + const char **names; + int flags; + void **ret_iter; +{ + return profile_node_iterator_create(profile, names, flags, ret_iter); +} + +void profile_iterator_free(iter_p) + void **iter_p; +{ + profile_node_iterator_free(iter_p); +} + +errcode_t profile_iterator(iter_p, ret_name, ret_value) + void **iter_p; + char **ret_name, **ret_value; +{ + return profile_node_iterator(iter_p, 0, ret_name, ret_value); +} + +void profile_release_string(str) + char *str; +{ + free(str); +} diff --git a/src/util/profile/prof_int.h b/src/util/profile/prof_int.h index 99d7fc1ae..1a0304f4c 100644 --- a/src/util/profile/prof_int.h +++ b/src/util/profile/prof_int.h @@ -62,7 +62,7 @@ struct _profile_t { typedef struct _profile_t *profile_t; /* - * Used by the profile node iterator in prof_tre.c + * Used by the profile iterator in prof_get.c */ #define PROFILE_ITER_LIST_SECTION 0x0001 #define PROFILE_ITER_SECTIONS_ONLY 0x0002 @@ -70,7 +70,6 @@ typedef struct _profile_t *profile_t; #define PROFILE_ITER_FINAL_SEEN 0x0100 - /* profile_parse.c */ errcode_t profile_parse_file @@ -181,3 +180,13 @@ errcode_t profile_get_relation_names errcode_t profile_get_subsection_names PROTOTYPE((profile_t profile, const char **names, char ***ret_names)); +errcode_t profile_iterator_create + PROTOTYPE((profile_t profile, const char **names, + int flags, void **ret_iter)); + +void profile_iterator_free PROTOTYPE((void **iter_p)); + +errcode_t profile_iterator + PROTOTYPE((void **iter_p, char **ret_name, char **ret_value)); + +void profile_release_string PROTOTYPE((char *str)); diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c index 3bb05d29f..ddfa08f44 100644 --- a/src/util/profile/prof_tree.c +++ b/src/util/profile/prof_tree.c @@ -531,5 +531,3 @@ get_new_file: *ret_value = p->value; return 0; }; - - diff --git a/src/util/profile/profile.hin b/src/util/profile/profile.hin index 42dc7fa2a..8984570f3 100644 --- a/src/util/profile/profile.hin +++ b/src/util/profile/profile.hin @@ -18,7 +18,6 @@ #define NEAR #endif - typedef struct _profile_t *profile_t; #if !defined(PROTOTYPE) @@ -29,6 +28,13 @@ typedef struct _profile_t *profile_t; #endif #endif +/* + * Used by the profile iterator in prof_get.c + */ +#define PROFILE_ITER_LIST_SECTION 0x0001 +#define PROFILE_ITER_SECTIONS_ONLY 0x0002 +#define PROFILE_ITER_RELATIONS_ONLY 0x0004 + long profile_init PROTOTYPE ((const char **filenames, profile_t *ret_profile)); @@ -59,4 +65,15 @@ long profile_get_relation_names long profile_get_subsection_names PROTOTYPE((profile_t profile, const char **names, char ***ret_names)); +long profile_iterator_create + PROTOTYPE((profile_t profile, const char **names, + int flags, void **ret_iter)); + +void profile_iterator_free PROTOTYPE((void **iter_p)); + +long profile_iterator + PROTOTYPE((void **iter_p, char **ret_name, char **ret_value)); + +void profile_release_string PROTOTYPE((char *str)); + #endif /* _KRB5_PROFILE_H */ -- 2.26.2