chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3e39ff6
)
remove len == 0 check, the index root is always '\0'
author
Kay Sievers
<kay.sievers@vrfy.org>
Thu, 13 Nov 2008 17:21:28 +0000
(18:21 +0100)
committer
Kay Sievers
<kay.sievers@vrfy.org>
Thu, 13 Nov 2008 17:21:28 +0000
(18:21 +0100)
udev/udev-rules.c
patch
|
blob
|
history
diff --git
a/udev/udev-rules.c
b/udev/udev-rules.c
index 796d2c157fa6eccbf20c21ac3acd3bcdccd90956..df9fc7877da2c2d7bfa46f0ebb81e5a7b9d0f5da 100644
(file)
--- a/
udev/udev-rules.c
+++ b/
udev/udev-rules.c
@@
-451,15
+451,10
@@
static int add_string(struct udev_rules *rules, const char *str)
unsigned int off;
struct trie_node *parent;
unsigned int off;
struct trie_node *parent;
- len = strlen(str);
-
- /* offset 0 is always '\0' */
- if (len == 0)
- return 0;
-
/* walk trie, start from last character of str to find matching tails */
/* walk trie, start from last character of str to find matching tails */
-
node_idx = 0
;
+
len = strlen(str)
;
key = str[len-1];
key = str[len-1];
+ node_idx = 0;
for (depth = 0; depth <= len; depth++) {
struct trie_node *node;
unsigned int child_idx;
for (depth = 0; depth <= len; depth++) {
struct trie_node *node;
unsigned int child_idx;
@@
-1723,7
+1718,7
@@
struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
if (rules->trie_nodes == NULL)
return NULL;
rules->trie_nodes_max = PREALLOC_TRIE;
if (rules->trie_nodes == NULL)
return NULL;
rules->trie_nodes_max = PREALLOC_TRIE;
- /* offset 0 is the trie root */
+ /* offset 0 is the trie root
, with an empty string
*/
memset(rules->trie_nodes, 0x00, sizeof(struct trie_node));
rules->trie_nodes_cur = 1;
memset(rules->trie_nodes, 0x00, sizeof(struct trie_node));
rules->trie_nodes_cur = 1;