*
* Domain names are stored in \ref ldns_rdf structures, with the type
* \ref LDNS_RDF_TYPE_DNAME
- *
+ *
* This module is *NOT* about the RR type called DNAME.
*/
* \param[in] n the label nr to clone from, if this is 0, the complete
* dname is cloned
* \return A newly allocated *rdf structure, containing the cloned dname,
- * or NULL if either d was NULL, not a dname, or if n >=
+ * or NULL if either d was NULL, not a dname, or if n >=
* label_count
*/
ldns_rdf *
ldns_dname_clone_from(const ldns_rdf *d, uint16_t n);
/**
- * chop one label off the left side of a dname. so
+ * chop one label off the left side of a dname. so
* wwww.nlnetlabs.nl, becomes nlnetlabs.nl
* This new name is a clone and must be freed with ldns_deep_free()
* \param[in] d the dname to chop
* count the number of labels inside a LDNS_RDF_DNAME type rdf.
* \param[in] *r the rdf
* \return the number of labels
- */
+ */
uint8_t ldns_dname_label_count(const ldns_rdf *r);
/**
/**
* Create a new dname rdf from a string
- * \param[in] s the size of the new dname
+ * \param[in] s the size of the new dname
* \param[in] *data pointer to the actual data
* \return ldns_rdf*
*/
* rbtree.h -- generic red-black tree
*
* Copyright (c) 2001-2008, NLnet Labs. All rights reserved.
- *
+ *
* This software is open source.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* Neither the name of the NLNET LABS nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
/** The number of the nodes in the tree */
size_t count;
- /**
- * Key compare function. <0,0,>0 like strcmp.
- * Return 0 on two NULL ptrs.
+ /**
+ * Key compare function. <0,0,>0 like strcmp.
+ * Return 0 on two NULL ptrs.
*/
int (*cmp) (const void *, const void *);
};
-/**
- * Create new tree (malloced) with given key compare function.
+/**
+ * Create new tree (malloced) with given key compare function.
* @param cmpf: compare function (like strcmp) takes pointers to two keys.
* @return: new tree, empty.
*/
*/
void ldns_rbtree_free(ldns_rbtree_t *rbtree);
-/**
- * Init a new tree (malloced by caller) with given key compare function.
+/**
+ * Init a new tree (malloced by caller) with given key compare function.
* @param rbtree: uninitialised memory for new tree, returned empty.
* @param cmpf: compare function (like strcmp) takes pointers to two keys.
*/
void ldns_rbtree_init(ldns_rbtree_t *rbtree, int (*cmpf)(const void *, const void *));
-/**
- * Insert data into the tree.
+/**
+ * Insert data into the tree.
* @param rbtree: tree to insert to.
- * @param data: element to insert.
- * @return: data ptr or NULL if key already present.
+ * @param data: element to insert.
+ * @return: data ptr or NULL if key already present.
*/
ldns_rbnode_t *ldns_rbtree_insert(ldns_rbtree_t *rbtree, ldns_rbnode_t *data);
* Delete element from tree.
* @param rbtree: tree to delete from.
* @param key: key of item to delete.
- * @return: node that is now unlinked from the tree. User to delete it.
- * returns 0 if node not present
+ * @return: node that is now unlinked from the tree. User to delete it.
+ * returns 0 if node not present
*/
ldns_rbnode_t *ldns_rbtree_delete(ldns_rbtree_t *rbtree, const void *key);
* @param result: set to the exact node if present, otherwise to element that
* precedes the position of key in the tree. NULL if no smaller element.
* @return: true if exact match in result. Else result points to <= element,
- * or NULL if key is smaller than the smallest key.
+ * or NULL if key is smaller than the smallest key.
*/
-int ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key,
+int ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key,
ldns_rbnode_t **result);
/**
/**
* Call with node=variable of struct* with rbnode_t as first element.
- * with type is the type of a pointer to that struct.
+ * with type is the type of a pointer to that struct.
*/
#define LDNS_RBTREE_FOR(node, type, rbtree) \
for(node=(type)ldns_rbtree_first(rbtree); \
* The function must not alter the rbtree.
* @param arg: user argument.
*/
-void ldns_traverse_postorder(ldns_rbtree_t* tree,
+void ldns_traverse_postorder(ldns_rbtree_t* tree,
void (*func)(ldns_rbnode_t*, void*), void* arg);
#endif /* UTIL_RBTREE_H_ */