+2004-02-18 Ken Raeburn <raeburn@mit.edu>
+
+ * prof_file.c, prof_get.c, prof_init.c, prof_parse.c, prof_set.c,
+ prof_tree.c: Use ANSI style function definitions.
+
2004-01-30 Alexandra Ellwood <lxs@mit.edu>
* prof-int.h: prof-int.h should include pthread.h when USE_PTHREADS
static void profile_free_file_data(prf_data_t);
-static int rw_access(filespec)
- profile_filespec_t filespec;
+static int rw_access(profile_filespec_t filespec)
{
#ifdef HAVE_ACCESS
if (access(filespec, W_OK) == 0)
}
#ifdef SHARE_TREE_DATA
-static int r_access(filespec)
- profile_filespec_t filespec;
+static int r_access(profile_filespec_t filespec)
{
#ifdef HAVE_ACCESS
if (access(filespec, R_OK) == 0)
}
#endif /* SHARE_TREE_DATA */
-errcode_t profile_open_file(filespec, ret_prof)
- const_profile_filespec_t filespec;
- prf_file_t *ret_prof;
+errcode_t profile_open_file(const_profile_filespec_t filespec,
+ prf_file_t *ret_prof)
{
prf_file_t prf;
errcode_t retval;
#endif
}
-errcode_t profile_flush_file_data(data)
- prf_data_t data;
+errcode_t profile_flush_file_data(prf_data_t data)
{
FILE *f;
profile_filespec_t new_file;
#endif
}
-void profile_free_file(prf)
- prf_file_t prf;
+void profile_free_file(prf_file_t prf)
{
profile_dereference_data(prf->data);
free(prf);
}
/* Call with mutex locked! */
-static void profile_free_file_data(data)
- prf_data_t data;
+static void profile_free_file_data(prf_data_t data)
{
#ifdef SHARE_TREE_DATA
if (data->flags & PROFILE_FILE_SHARED) {
#endif
}
-errcode_t profile_close_file(prf)
- prf_file_t prf;
+errcode_t profile_close_file(prf_file_t prf)
{
errcode_t retval;
/*
* Initialize the string list abstraction.
*/
-static errcode_t init_list(list)
- struct profile_string_list *list;
+static errcode_t init_list(struct profile_string_list *list)
{
list->num = 0;
list->max = 10;
* Free any memory left over in the string abstraction, returning the
* built up list in *ret_list if it is non-null.
*/
-static void end_list(list, ret_list)
- struct profile_string_list *list;
- char ***ret_list;
+static void end_list(struct profile_string_list *list, char ***ret_list)
{
char **cp;
/*
* Add a string to the list.
*/
-static errcode_t add_to_list(list, str)
- struct profile_string_list *list;
- const char *str;
+static errcode_t add_to_list(struct profile_string_list *list, const char *str)
{
char *newstr, **newlist;
int newmax;
/*
* Return TRUE if the string is already a member of the list.
*/
-static int is_list_member(list, str)
- struct profile_string_list *list;
- const char *str;
+static int is_list_member(struct profile_string_list *list, const char *str)
{
char **cpp;
* This function frees a null-terminated list as returned by
* profile_get_values.
*/
-void KRB5_CALLCONV profile_free_list(list)
- char **list;
+void KRB5_CALLCONV profile_free_list(char **list)
{
char **cp;
}
errcode_t KRB5_CALLCONV
-profile_get_values(profile, names, ret_values)
- profile_t profile;
- const char *const *names;
- char ***ret_values;
+profile_get_values(profile_t profile, const char *const *names,
+ char ***ret_values)
{
errcode_t retval;
void *state;
* This function only gets the first value from the file; it is a
* helper function for profile_get_string, profile_get_integer, etc.
*/
-errcode_t profile_get_value(profile, names, ret_value)
- profile_t profile;
- const char **names;
- const char **ret_value;
+errcode_t profile_get_value(profile_t profile, const char **names,
+ const char **ret_value)
{
errcode_t retval;
void *state;
}
errcode_t KRB5_CALLCONV
-profile_get_string(profile, name, subname, subsubname,
- def_val, ret_string)
- profile_t profile;
- const char *name, *subname, *subsubname;
- const char *def_val;
- char **ret_string;
+profile_get_string(profile_t profile, const char *name, const char *subname,
+ const char *subsubname, const char *def_val,
+ char **ret_string)
{
const char *value;
errcode_t retval;
}
errcode_t KRB5_CALLCONV
-profile_get_integer(profile, name, subname, subsubname,
- def_val, ret_int)
- profile_t profile;
- const char *name, *subname, *subsubname;
- int def_val;
- int *ret_int;
+profile_get_integer(profile_t profile, const char *name, const char *subname,
+ const char *subsubname, int def_val, int *ret_int)
{
const char *value;
errcode_t retval;
};
static errcode_t
-profile_parse_boolean(s, ret_boolean)
- char *s;
- int* ret_boolean;
+profile_parse_boolean(char *s, int *ret_boolean)
{
const char *const *p;
}
errcode_t KRB5_CALLCONV
-profile_get_boolean(profile, name, subname, subsubname,
- def_val, ret_boolean)
- profile_t profile;
- const char *name, *subname, *subsubname;
- int def_val;
- int *ret_boolean;
+profile_get_boolean(profile_t profile, const char *name, const char *subname,
+ const char *subsubname, int def_val, int *ret_boolean)
{
const char *value;
errcode_t retval;
* under the specified section name.
*/
errcode_t KRB5_CALLCONV
-profile_get_subsection_names(profile, names, ret_names)
- profile_t profile;
- const char **names;
- char ***ret_names;
+profile_get_subsection_names(profile_t profile, const char **names,
+ char ***ret_names)
{
errcode_t retval;
void *state;
* under the specified section name.
*/
errcode_t KRB5_CALLCONV
-profile_get_relation_names(profile, names, ret_names)
- profile_t profile;
- const char **names;
- char ***ret_names;
+profile_get_relation_names(profile_t profile, const char **names,
+ char ***ret_names)
{
errcode_t retval;
void *state;
}
errcode_t KRB5_CALLCONV
-profile_iterator_create(profile, names, flags, ret_iter)
- profile_t profile;
- const char *const *names;
- int flags;
- void **ret_iter;
+profile_iterator_create(profile_t profile, const char *const *names, int flags,
+ void **ret_iter)
{
return profile_node_iterator_create(profile, names, flags, ret_iter);
}
void KRB5_CALLCONV
-profile_iterator_free(iter_p)
- void **iter_p;
+profile_iterator_free(void **iter_p)
{
profile_node_iterator_free(iter_p);
}
errcode_t KRB5_CALLCONV
-profile_iterator(iter_p, ret_name, ret_value)
- void **iter_p;
- char **ret_name, **ret_value;
+profile_iterator(void **iter_p, char **ret_name, char **ret_value)
{
char *name, *value;
errcode_t retval;
}
void KRB5_CALLCONV
-profile_release_string(str)
- char *str;
+profile_release_string(char *str)
{
free(str);
}
#endif /* SIZEOF_LONG == 4 */
errcode_t KRB5_CALLCONV
-profile_init(files, ret_profile)
- const_profile_filespec_t *files;
- profile_t *ret_profile;
+profile_init(const_profile_filespec_t *files, profile_t *ret_profile)
{
const_profile_filespec_t *fs;
profile_t profile;
}
errcode_t KRB5_CALLCONV
-profile_init_path(filepath, ret_profile)
- const_profile_filespec_list_t filepath;
- profile_t *ret_profile;
+profile_init_path(const_profile_filespec_list_t filepath,
+ profile_t *ret_profile)
{
int n_entries, i;
unsigned int ent_len;
}
errcode_t KRB5_CALLCONV
-profile_flush(profile)
- profile_t profile;
+profile_flush(profile_t profile)
{
if (!profile || profile->magic != PROF_MAGIC_PROFILE)
return PROF_MAGIC_PROFILE;
}
void KRB5_CALLCONV
-profile_abandon(profile)
- profile_t profile;
+profile_abandon(profile_t profile)
{
prf_file_t p, next;
}
void KRB5_CALLCONV
-profile_release(profile)
- profile_t profile;
+profile_release(profile_t profile)
{
prf_file_t p, next;
/*
* Here begins the profile serialization functions.
*/
-errcode_t profile_ser_size(unused, profile, sizep)
- const char *unused;
- profile_t profile;
- size_t *sizep;
+errcode_t profile_ser_size(const char *unused, profile_t profile,
+ size_t *sizep)
{
size_t required;
prf_file_t pfp;
return 0;
}
-static void pack_int32(oval, bufpp, remainp)
- prof_int32 oval;
- unsigned char **bufpp;
- size_t *remainp;
+static void pack_int32(prof_int32 oval, unsigned char **bufpp, size_t *remainp)
{
(*bufpp)[0] = (unsigned char) ((oval >> 24) & 0xff);
(*bufpp)[1] = (unsigned char) ((oval >> 16) & 0xff);
*remainp -= sizeof(prof_int32);
}
-errcode_t profile_ser_externalize(unused, profile, bufpp, remainp)
- const char *unused;
- profile_t profile;
- unsigned char **bufpp;
- size_t *remainp;
+errcode_t profile_ser_externalize(const char *unused, profile_t profile,
+ unsigned char **bufpp, size_t *remainp)
{
errcode_t retval;
size_t required;
return(retval);
}
-static int unpack_int32(intp, bufpp, remainp)
- prof_int32 *intp;
- unsigned char **bufpp;
- size_t *remainp;
+static int unpack_int32(prof_int32 *intp, unsigned char **bufpp,
+ size_t *remainp)
{
if (*remainp >= sizeof(prof_int32)) {
*intp = (((prof_int32) (*bufpp)[0] << 24) |
return 1;
}
-errcode_t profile_ser_internalize(unused, profilep, bufpp, remainp)
- const char *unused;
- profile_t *profilep;
- unsigned char **bufpp;
- size_t *remainp;
+errcode_t profile_ser_internalize(const char *unused, profile_t *profilep,
+ unsigned char **bufpp, size_t *remainp)
{
errcode_t retval;
unsigned char *bp;
struct profile_node *current_section;
};
-static char *skip_over_blanks(cp)
- char *cp;
+static char *skip_over_blanks(char *cp)
{
while (*cp && isspace((int) (*cp)))
cp++;
return cp;
}
-static void strip_line(line)
- char *line;
+static void strip_line(char *line)
{
char *p = line + strlen(line);
while (p > line && (p[-1] == '\n' || p[-1] == '\r'))
}
-static errcode_t parse_init_state(state)
- struct parse_state *state;
+static errcode_t parse_init_state(struct parse_state *state)
{
state->state = STATE_INIT_COMMENT;
state->group_level = 0;
return profile_create_node("(root)", 0, &state->root_section);
}
-static errcode_t parse_std_line(line, state)
- char *line;
- struct parse_state *state;
+static errcode_t parse_std_line(char *line, struct parse_state *state)
{
char *cp, ch, *tag, *value;
char *p;
return 0;
}
-static errcode_t parse_line(line, state)
- char *line;
- struct parse_state *state;
+static errcode_t parse_line(char *line, struct parse_state *state)
{
char *cp;
return 0;
}
-errcode_t profile_parse_file(f, root)
- FILE *f;
- struct profile_node **root;
+errcode_t profile_parse_file(FILE *f, struct profile_node **root)
{
#define BUF_SIZE 2048
char *bptr;
/*
* Return TRUE if the string begins or ends with whitespace
*/
-static int need_double_quotes(str)
- char *str;
+static int need_double_quotes(char *str)
{
if (!str || !*str)
return 0;
* Output a string with double quotes, doing appropriate backquoting
* of characters as necessary.
*/
-static void output_quoted_string(str, f)
- char *str;
- FILE *f;
+static void output_quoted_string(char *str, FILE *f)
{
char ch;
#define EOL "\n"
#endif
-static void dump_profile_to_file(root, level, dstfile)
- struct profile_node *root;
- int level;
- FILE *dstfile;
+static void dump_profile_to_file(struct profile_node *root, int level,
+ FILE *dstfile)
{
int i;
struct profile_node *p;
} while (iter != 0);
}
-errcode_t profile_write_tree_file(root, dstfile)
- struct profile_node *root;
- FILE *dstfile;
+errcode_t profile_write_tree_file(struct profile_node *root, FILE *dstfile)
{
dump_profile_to_file(root, 0, dstfile);
return 0;
#endif
#include <errno.h>
-static errcode_t rw_setup(profile)
- profile_t profile;
+static errcode_t rw_setup(profile_t profile)
{
prf_file_t file;
errcode_t retval = 0;
* ADL - 2/23/99, rewritten TYT 2/25/99
*/
errcode_t KRB5_CALLCONV
-profile_update_relation(profile, names, old_value, new_value)
- profile_t profile;
- const char **names;
- const char *old_value;
- const char *new_value;
+profile_update_relation(profile_t profile, const char **names,
+ const char *old_value, const char *new_value)
{
errcode_t retval;
struct profile_node *section, *node;
* TYT - 2/25/99
*/
errcode_t KRB5_CALLCONV
-profile_clear_relation(profile, names)
- profile_t profile;
- const char **names;
+profile_clear_relation(profile_t profile, const char **names)
{
errcode_t retval;
struct profile_node *section, *node;
* ADL - 2/23/99, rewritten TYT 2/25/99
*/
errcode_t KRB5_CALLCONV
-profile_rename_section(profile, names, new_name)
- profile_t profile;
- const char **names;
- const char *new_name;
+profile_rename_section(profile_t profile, const char **names,
+ const char *new_name)
{
errcode_t retval;
struct profile_node *section, *node;
* ADL - 2/23/99, rewritten TYT 2/25/99
*/
errcode_t KRB5_CALLCONV
-profile_add_relation(profile, names, new_value)
- profile_t profile;
- const char **names;
- const char *new_value;
+profile_add_relation(profile_t profile, const char **names,
+ const char *new_value)
{
errcode_t retval;
struct profile_node *section;
/*
* Free a node, and any children
*/
-void profile_free_node(node)
- struct profile_node *node;
+void profile_free_node(struct profile_node *node)
{
struct profile_node *child, *next;
/*
* Create a node
*/
-errcode_t profile_create_node(name, value, ret_node)
- const char *name, *value;
- struct profile_node **ret_node;
+errcode_t profile_create_node(const char *name, const char *value,
+ struct profile_node **ret_node)
{
struct profile_node *new;
* the profile are true. If not, we have a programming bug somewhere,
* probably in this file.
*/
-errcode_t profile_verify_node(node)
- struct profile_node *node;
+errcode_t profile_verify_node(struct profile_node *node)
{
struct profile_node *p, *last;
errcode_t retval;
/*
* Add a node to a particular section
*/
-errcode_t profile_add_node(section, name, value, ret_node)
- struct profile_node *section;
- const char *name, *value;
- struct profile_node **ret_node;
+errcode_t profile_add_node(struct profile_node *section, const char *name,
+ const char *value, struct profile_node **ret_node)
{
errcode_t retval;
struct profile_node *p, *last, *new;
/*
* Set the final flag on a particular node.
*/
-errcode_t profile_make_node_final(node)
- struct profile_node *node;
+errcode_t profile_make_node_final(struct profile_node *node)
{
CHECK_MAGIC(node);
/*
* Check the final flag on a node
*/
-int profile_is_node_final(node)
- struct profile_node *node;
+int profile_is_node_final(struct profile_node *node)
{
return (node->final != 0);
}
* only; if the name needs to be returned from an exported function,
* strdup it first!)
*/
-const char *profile_get_node_name(node)
- struct profile_node *node;
+const char *profile_get_node_name(struct profile_node *node)
{
return node->name;
}
* only; if the name needs to be returned from an exported function,
* strdup it first!)
*/
-const char *profile_get_node_value(node)
- struct profile_node *node;
+const char *profile_get_node_value(struct profile_node *node)
{
return node->value;
}
* (This won't happen if section_flag is non-zero, obviously.)
*
*/
-errcode_t profile_find_node(section, name, value, section_flag, state, node)
- struct profile_node *section;
- const char *name;
- const char *value;
- int section_flag;
- void **state;
- struct profile_node **node;
+errcode_t profile_find_node(struct profile_node *section, const char *name,
+ const char *value, int section_flag, void **state,
+ struct profile_node **node)
{
struct profile_node *p;
* returned to a calling application (profile_find_node_relation is not an
* exported interface), it should be strdup()'ed.
*/
-errcode_t profile_find_node_relation(section, name, state, ret_name, value)
- struct profile_node *section;
- const char *name;
- void **state;
- char **ret_name, **value;
+errcode_t profile_find_node_relation(struct profile_node *section,
+ const char *name, void **state,
+ char **ret_name, char **value)
{
struct profile_node *p;
errcode_t retval;
* profile node) makes this function mostly syntactic sugar for
* profile_find_node.
*/
-errcode_t profile_find_node_subsection(section, name, state, ret_name,
- subsection)
- struct profile_node *section;
- const char *name;
- void **state;
- char **ret_name;
- struct profile_node **subsection;
+errcode_t profile_find_node_subsection(struct profile_node *section,
+ const char *name, void **state,
+ char **ret_name,
+ struct profile_node **subsection)
{
struct profile_node *p;
errcode_t retval;
/*
* This function returns the parent of a particular node.
*/
-errcode_t profile_get_node_parent(section, parent)
- struct profile_node *section, **parent;
+errcode_t profile_get_node_parent(struct profile_node *section,
+ struct profile_node **parent)
{
*parent = section->parent;
return 0;
int num;
};
-errcode_t profile_node_iterator_create(profile, names, flags, ret_iter)
- profile_t profile;
- const char *const *names;
- int flags;
- void **ret_iter;
+errcode_t profile_node_iterator_create(profile_t profile,
+ const char *const *names, int flags,
+ void **ret_iter)
{
struct profile_iterator *iter;
int done_idx = 0;
return 0;
}
-void profile_node_iterator_free(iter_p)
- void **iter_p;
+void profile_node_iterator_free(void **iter_p)
{
struct profile_iterator *iter;
* (profile_node_iterator is not an exported interface), it should be
* strdup()'ed.
*/
-errcode_t profile_node_iterator(iter_p, ret_node, ret_name, ret_value)
- void **iter_p;
- struct profile_node **ret_node;
- char **ret_name, **ret_value;
+errcode_t profile_node_iterator(void **iter_p, struct profile_node **ret_node,
+ char **ret_name, char **ret_value)
{
struct profile_iterator *iter = *iter_p;
struct profile_node *section, *p;
*
* TYT, 2/25/99
*/
-errcode_t profile_remove_node(node)
- struct profile_node *node;
+errcode_t profile_remove_node(struct profile_node *node)
{
CHECK_MAGIC(node);
*
* TYT, 2/25/99
*/
-errcode_t profile_set_relation_value(node, new_value)
- struct profile_node *node;
- const char *new_value;
+errcode_t profile_set_relation_value(struct profile_node *node,
+ const char *new_value)
{
char *cp;
*
* TYT 2/25/99
*/
-errcode_t profile_rename_node(node, new_name)
- struct profile_node *node;
- const char *new_name;
+errcode_t profile_rename_node(struct profile_node *node, const char *new_name)
{
char *new_string;
struct profile_node *p, *last;