summaryrefslogtreecommitdiff
path: root/src/atom.c
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2013-12-02 14:25:51 +0200
committerRan Benita <ran234@gmail.com>2013-12-02 14:26:37 +0200
commit1374b50ed7ae3dfa34c653cd208ff5c059c0cce5 (patch)
tree035cf530a933b1089a2be45b26f24c4ea23e2395 /src/atom.c
parent048ee7031d8598913e778b9d4de6097584e48971 (diff)
downloadxorg-lib-libxkbcommon-1374b50ed7ae3dfa34c653cd208ff5c059c0cce5.tar.gz
atom: tiny style fixes
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/atom.c')
-rw-r--r--src/atom.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/atom.c b/src/atom.c
index 5d86cf9..c56eb92 100644
--- a/src/atom.c
+++ b/src/atom.c
@@ -138,11 +138,10 @@ static bool
find_node_pointer(struct atom_table *table, const char *string, size_t len,
struct atom_node ***nodep_out, unsigned int *fingerprint_out)
{
- struct atom_node **nodep;
+ struct atom_node **nodep = &table->root;
unsigned int fingerprint = 0;
bool found = false;
- nodep = &table->root;
for (size_t i = 0; i < (len + 1) / 2; i++) {
fingerprint = fingerprint * 27 + string[i];
fingerprint = fingerprint * 27 + string[len - 1 - i];
@@ -150,19 +149,19 @@ find_node_pointer(struct atom_table *table, const char *string, size_t len,
while (*nodep) {
if (fingerprint < (*nodep)->fingerprint) {
- nodep = &((*nodep)->left);
+ nodep = &(*nodep)->left;
}
else if (fingerprint > (*nodep)->fingerprint) {
- nodep = &((*nodep)->right);
+ nodep = &(*nodep)->right;
}
else {
/* Now start testing the strings. */
const int cmp = strncmp(string, (*nodep)->string, len);
if (cmp < 0 || (cmp == 0 && len < strlen((*nodep)->string))) {
- nodep = &((*nodep)->left);
+ nodep = &(*nodep)->left;
}
else if (cmp > 0) {
- nodep = &((*nodep)->right);
+ nodep = &(*nodep)->right;
}
else {
found = true;