• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/MITKerberosShim-66/profile/

Lines Matching +defs:next +defs:node +defs:name

9  * Each node may represent either a relation or a section header.
32 char *name;
35 unsigned int final:1; /* Indicate don't search next file */
39 struct profile_node *next, *prev;
42 #define CHECK_MAGIC(node) \
43 if ((node)->magic != PROF_MAGIC_NODE) \
47 * Free a node, and any children
49 void profile_free_node(struct profile_node *node)
51 struct profile_node *child, *next;
53 if (node->magic != PROF_MAGIC_NODE)
56 if (node->name)
57 free(node->name);
58 if (node->value)
59 free(node->value);
61 for (child=node->first_child; child; child = next) {
62 next = child->next;
65 node->magic = 0;
67 free(node);
84 * Create a node
86 errcode_t profile_create_node(const char *name, const char *value,
97 new->name = strdup(name);
98 if (new->name == 0) {
119 errcode_t profile_verify_node(struct profile_node *node)
124 CHECK_MAGIC(node);
126 if (node->value && node->first_child)
130 for (p = node->first_child; p; last = p, p = p->next) {
133 if (last && (last->next != p))
135 if (node->group_level+1 != p->group_level)
137 if (p->parent != node)
147 * Add a node to a particular section
149 errcode_t profile_add_node(struct profile_node *section, const char *name,
161 * Find the place to insert the new node. We look for the
162 * place *after* the last match of the node name, since
165 for (p=section->first_child, last = 0; p; last = p, p = p->next) {
167 cmp = strcmp(p->name, name);
171 retval = profile_create_node(name, value, &new);
178 new->next = p;
182 last->next = new;
191 * Set the final flag on a particular node.
193 errcode_t profile_make_node_final(struct profile_node *node)
195 CHECK_MAGIC(node);
197 node->final = 1;
202 * Check the final flag on a node
204 int profile_is_node_final(struct profile_node *node)
206 return (node->final != 0);
210 * Return the name of a node. (Note: this is for internal functions
211 * only; if the name needs to be returned from an exported function,
214 const char *profile_get_node_name(struct profile_node *node)
216 return node->name;
220 * Return the value of a node. (Note: this is for internal functions
221 * only; if the name needs to be returned from an exported function,
224 const char *profile_get_node_value(struct profile_node *node)
226 return node->value;
231 * the given name. If name is NULL, then interate through all the
233 * section which matches the name; don't return relations. If value
243 errcode_t profile_find_node(struct profile_node *section, const char *name,
245 struct profile_node **node)
256 for (; p; p = p->next) {
257 if (name && (strcmp(p->name, name)))
271 if (node)
272 *node = p;
284 for (p = p->next; p; p = p->next) {
285 if (name && (strcmp(p->name, name)))
306 * the given name. If name is NULL, then interate through all the
318 const char *name, void **state,
324 retval = profile_find_node(section, name, 0, 0, state, &p);
332 *ret_name = p->name;
339 * the given name. If name is NULL, then interate through all the
345 * This is (plus accessor functions for the name and value given a
346 * profile node) makes this function mostly syntactic sugar for
350 const char *name, void **state,
357 retval = profile_find_node(section, name, 0, 1, state, &p);
365 *ret_name = p->name;
371 * This function returns the parent of a particular node.
382 * match the specified name array.
389 const char *name;
393 struct profile_node *node;
425 iter->node = 0;
467 * If the file has changed, then the node pointer is invalid,
475 if (iter->node && (iter->file->data->upd_serial != iter->file_serial)) {
478 iter->node = 0;
480 if (iter->node && iter->node->magic != PROF_MAGIC_NODE) {
486 if (iter->node == 0) {
504 iter->file = iter->file->next;
532 for (p=section->first_child; p; p = p->next) {
533 if (!strcmp(p->name, *cpp) && !p->value)
546 iter->file = iter->file->next;
557 iter->name = *cpp;
558 iter->node = section->first_child;
561 * OK, now we know iter->node is set up correctly. Let's do
564 for (p = iter->node; p; p = p->next) {
565 if (iter->name && strcmp(p->name, iter->name))
584 iter->file = iter->file->next;
592 iter->node = 0;
597 if ((iter->node = p->next) == NULL)
598 iter->file = iter->file->next;
602 *ret_name = p->name;
609 * Remove a particular node.
613 errcode_t profile_remove_node(struct profile_node *node)
615 CHECK_MAGIC(node);
617 if (node->parent == 0)
620 node->deleted = 1;
626 * Set the value of a specific node containing a relation.
630 errcode_t profile_set_relation_value(struct profile_node *node,
635 CHECK_MAGIC(node);
637 if (!node->value)
644 free(node->value);
645 node->value = cp;
651 * Rename a specific node
655 errcode_t profile_rename_node(struct profile_node *node, const char *new_name)
660 CHECK_MAGIC(node);
662 if (strcmp(new_name, node->name) == 0)
663 return 0; /* It's the same name, return */
666 * Make sure we can allocate memory for the new name, first!
673 * Find the place to where the new node should go. We look
674 * for the place *after* the last match of the node name,
677 for (p=node->parent->first_child, last = 0; p; last = p, p = p->next) {
678 if (strcmp(p->name, new_name) > 0)
683 * If we need to move the node, do it now.
685 if ((p != node) && (last != node)) {
687 * OK, let's detach the node
689 if (node->prev)
690 node->prev->next = node->next;
692 node->parent->first_child = node->next;
693 if (node->next)
694 node->next->prev = node->prev;
700 p->prev = node;
702 last->next = node;
704 node->parent->first_child = node;
705 node->next = p;
706 node->prev = last;
709 free(node->name);
710 node->name = new_string;