void **iter_p;
char **ret_name, **ret_value;
{
- return profile_node_iterator(iter_p, 0, ret_name, ret_value);
+ char *name, *value;
+ errcode_t retval;
+
+ retval = profile_node_iterator(iter_p, 0, &name, &value);
+ if (retval)
+ return retval;
+
+ if (ret_name) {
+ if (name) {
+ *ret_name = malloc(strlen(name)+1);
+ if (!*ret_name)
+ return ENOMEM;
+ strcpy(*ret_name, name);
+ } else
+ *ret_name = 0;
+ }
+ if (ret_value) {
+ if (value) {
+ *ret_value = malloc(strlen(value)+1);
+ if (!*ret_value) {
+ if (ret_name) {
+ free(*ret_name);
+ *ret_name = 0;
+ }
+ return ENOMEM;
+ }
+ strcpy(*ret_value, value);
+ } else
+ *ret_value = 0;
+ }
+ return 0;
}
void profile_release_string(str)
*
* The returned character string in value points to the stored
* character string in the parse string. Before this string value is
- * returned to a calling application (profile_find_node_relatioon is not an
+ * 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)
*iter_p = 0;
}
+/*
+ * Note: the returned character strings in ret_name and ret_value
+ * points to the stored character string in the parse string. Before
+ * this string value is returned to a calling application
+ * (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;