#define NDEBUG
+#ifdef __GNUC__
+#define EXT2FS_ATTR(x) __attribute__(x)
+#else
+#define EXT2FS_ATTR(x)
+#endif
+
+#include "config.h"
#include <stdlib.h>
#include <stddef.h>
#include <assert.h>
/*
* These macros provide short convenient names for structure members,
* which are embellished with dict_ prefixes so that they are
- * properly confined to the documented namespace. It's legal for a
+ * properly confined to the documented namespace. It's legal for a
* program which uses dict to define, for instance, a macro called ``parent''.
* Such a macro would interfere with the dnode_t struct definition.
* In general, highly portable and reusable C modules which expose their
* dict_next() successor function, verifying that the key of each node is
* strictly lower than that of its successor, if duplicates are not allowed,
* or lower or equal if duplicates are allowed. This function is used for
- * debugging purposes.
+ * debugging purposes.
*/
#ifndef NDEBUG
static int verify_bintree(dict_t *dict)
if (root->color != dnode_black)
return 0;
return height_left + 1;
- }
+ }
return 1;
}
}
#ifdef E2FSCK_NOTUSED
-/*
+/*
* Initialize a dictionary in the likeness of another dictionary
*/
* debugging purposes, and should be placed in assert statements. Just because
* this function succeeds doesn't mean that the tree is not corrupt. Certain
* corruptions in the tree may simply cause undefined behavior.
- */
+ */
int dict_verify(dict_t *dict)
{
/*
* Locate a node in the dictionary having the given key.
- * If the node is not found, a null a pointer is returned (rather than
+ * If the node is not found, a null a pointer is returned (rather than
* a pointer that dictionary's nil sentinel node), otherwise a pointer to the
* located node is returned.
*/
tentative = root;
root = root->left;
}
- }
+ }
}
-
+
return tentative;
}
tentative = root;
root = root->right;
}
- }
+ }
}
-
+
return tentative;
}
#endif
child = (delete->left != nil) ? delete->left : delete->right;
- child->parent = delparent = delete->parent;
+ child->parent = delparent = delete->parent;
if (delete == delparent->left) {
- delparent->left = child;
+ delparent->left = child;
} else {
assert (delete == delparent->right);
delparent->right = child;
return verify_dict_has_node(dict_nil(dict), dict_root(dict), node);
}
-static dnode_t *dnode_alloc(void *context)
+static dnode_t *dnode_alloc(void *context EXT2FS_ATTR((unused)))
{
return malloc(sizeof *dnode_alloc(NULL));
}
-static void dnode_free(dnode_t *node, void *context)
+static void dnode_free(dnode_t *node, void *context EXT2FS_ATTR((unused)))
{
free(node);
}
{
dict_t *dict = load->dictptr;
dnode_t *nil = &load->nilnode;
-
+
assert (!dnode_is_in_a_dict(newnode));
assert (dict->nodecount < dict->maxcount);
dict_load_t load;
dnode_t *leftnode = dict_first(dest), *rightnode = dict_first(source);
- assert (dict_similar(dest, source));
+ assert (dict_similar(dest, source));
if (source == dest)
return;
leftnode = next;
continue;
}
-
+
copyright:
{
dnode_t *next = dict_next(source, rightnode);
static int tokenize(char *string, ...)
{
- char **tokptr;
+ char **tokptr;
va_list arglist;
int tokcount = 0;
dnode_t *dn;
char *tok1, *tok2, *val;
const char *key;
- char *help =
+ char *help =
"p turn prompt on\n"
"q finish construction\n"
"a <key> <val> add new entry\n";