diff options
| author | Theodore Tso <tytso@mit.edu> | 1998-11-03 22:49:25 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1998-11-03 22:49:25 +0000 |
| commit | a77feae4293dbdba211ca39a275da85e7c3b655f (patch) | |
| tree | e5d2dd560fe394343167007cc7e9c7bb04c240e1 /src/util/profile/prof_section.c | |
| parent | 186666be751244e0382e41cc175b5eb9e888b34d (diff) | |
| download | krb5-a77feae4293dbdba211ca39a275da85e7c3b655f.tar.gz krb5-a77feae4293dbdba211ca39a275da85e7c3b655f.tar.xz krb5-a77feae4293dbdba211ca39a275da85e7c3b655f.zip | |
Makefile.in: Added prof_get.c to the list of files to be compiled
profile.hin: Added declarations for profile_free_list(),
profile_get_relation_names(), and profile_get_subsection_names().
(These are new public interfaces to the profile library.)
prof_int.h: Removed the profile_section_t structure, which was used
only by the now-defunct prof_section.c file. Added the internal
interfaces for the new public interfaces. Removed unused declarations
which were never implemented(profile_get, profile_update).
prof_init.c: Moved all of the profile querying functions
(profile_get_values(), profile_get_value(), etc.) to prof_get.c. In
the process, removed the really bletcherous (and badly implemented)
profile_get_first_values(), which did nothing like what the named
implied. Also added to prof_get.c new functions
profile_get_subsection_names() and profile_get_relation_names().
(profile_ser_internalize): Rewrote error handling to be clearer, and
removed a bug where memory was not freed correctly in an error case.
(profile_init): If a list of pathnames is passed in, profile_init will
now try to open all of them, now that we've defined query fallback
semantics in prof_get.c
prof_parse.c: Fix lint warning.
prof_tree.c (profile_find_node_relation,
profile_find_node_subsection): Allow the returned value or subsection
field to be NULL (in case the caller isn't interested in getting the
returned value or subsection, and only cares about getting the name).
(profile_delete_node_relation, profile_delete_interior_node_relation):
Removed these functions and replaced it with profile_remove_node(),
which takes a boolean argument section_flag.
(profile_find_node_name): Removed this function. (This was a
Cygnus/Fusion special used by the now removed
profile_find_first_values() function.)
test_profile.c: Added commands to test the new
profile_get_subsection_names() and profile_get_relation_names()
interfaces.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11011 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile/prof_section.c')
| -rw-r--r-- | src/util/profile/prof_section.c | 170 |
1 files changed, 0 insertions, 170 deletions
diff --git a/src/util/profile/prof_section.c b/src/util/profile/prof_section.c deleted file mode 100644 index d147b7912..000000000 --- a/src/util/profile/prof_section.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * prof_section.c --- routines that manipulate the profile_section_t - * object - * - * XXX this file is still under construction. - */ - -#include <stdio.h> -#include <string.h> -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#include <errno.h> - -#include "prof_int.h" - -/* - * This routine frees a profile_section - */ -void profile_free_section(sect) - profile_section_t sect; -{ - if (sect->name) - free(sect->name); - sect->magic = 0; - free(sect); -} - -/* - * This routine creates a profile_section from its parent. If the - * parent is NULL, then a top-level profile section is created. - * - * Top-level profile sections are different from normal - * profile_sections in that top-level sections are agregated across - * multiple files, where as subsections are not. - */ -errcode_t profile_get_subsection(profile, parent, name, ret_name, - ret_section) - profile_t profile; - profile_section_t parent; - const char * name; - char ** ret_name; - profile_section_t *ret_section; -{ - profile_section_t section; - prf_file_t file; - errcode_t retval; - - section = malloc(sizeof(struct _profile_section_t)); - if (section == 0) - return ENOMEM; - memset(section, 0, sizeof(struct _profile_section_t)); - section->magic = PROF_MAGIC_SECTION; - section->name = malloc(strlen(name)+1); - if (section->name == 0) { - free(section); - return ENOMEM; - } - strcpy(section->name, name); - section->file_ptr = file = profile->first_file; - section->profile = profile; - - if (parent == 0) { - /* - * If parent is NULL, then we are creating a - * top-level section which hangs off the root. - * - * We make sure that the section exists in least one - * file. - */ - section->top_lvl = 1; - if (name == 0) - return PROF_TOPSECTION_ITER_NOSUPP; - while (file) { - retval = profile_find_node_subsection(file->root, - name, §ion->state, - ret_name, §ion->sect); - file = file->next; - if (retval == 0) - break; - if (retval == PROF_NO_SECTION) - continue; - profile_free_section(section); - return retval; - } - if (section->sect == 0 && file == 0) { - profile_free_section(section); - return PROF_NO_SECTION; - } - *ret_section = section; - return 0; - } - - - section->top_lvl = 0; - if (parent->top_lvl) { - section->top_lvl_search = 1; - - } else { - section->top_lvl_search = 0; - if (parent->sect == 0) { - profile_free_section(section); - return PROF_INVALID_SECTION; - } - section->parent = parent->sect; - retval = profile_find_node_subsection(parent->sect, - name, §ion->state, ret_name, §ion->sect); - if (retval) { - profile_free_section(section); - return retval; - } - } - *ret_section = section; - return 0; -} - -errcode_t profile_next_section(section, ret_name) - profile_section_t section; - char **ret_name; -{ - prf_file_t file; - errcode_t retval; - - if (section->top_lvl) - return PROF_END_OF_SECTIONS; - else { - if (section->sect == 0) - return PROF_INVALID_SECTION; - retval = profile_find_node_subsection(section->parent, - section->name, §ion->state, ret_name, §ion->sect); - if (retval == PROF_NO_SECTION) - retval = PROF_END_OF_SECTIONS; - return retval; - } -} - -errcode_t profile_get_relation(section, name, ret_values) - profile_section_t section; - const char *name; - char ***ret_values; -{ - prf_file_t file; - char **values; - int num_values; - int max_values; - char *value; - errcode_t retval; - - - max_values = 10; - values = malloc(sizeof(char *) * max_values); - - if (section->top_lvl) { - for (file = section->profile->first_file; file; - file = file->next) { - retval = profile_find_node_relation(file->root, - section->name, §ion->state, 0, &value); - if (retval) - continue; - - } - } else { - if (section->sect == 0) - return PROF_INVALID_SECTION; - } - return 0; -} - - - |
