Rev 4207 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4207 | Rev 4220 | ||
---|---|---|---|
Line 64... | Line 64... | ||
64 | ofw_tree_getprop(const ofw_tree_node_t *node, const char *name) |
64 | ofw_tree_getprop(const ofw_tree_node_t *node, const char *name) |
65 | { |
65 | { |
66 | unsigned int i; |
66 | unsigned int i; |
67 | 67 | ||
68 | for (i = 0; i < node->properties; i++) { |
68 | for (i = 0; i < node->properties; i++) { |
69 | if (strcmp(node->property[i].name, name) == 0) |
69 | if (str_cmp(node->property[i].name, name) == 0) |
70 | return &node->property[i]; |
70 | return &node->property[i]; |
71 | } |
71 | } |
72 | 72 | ||
73 | return NULL; |
73 | return NULL; |
74 | } |
74 | } |
Line 107... | Line 107... | ||
107 | 107 | ||
108 | /* |
108 | /* |
109 | * Try to find the disambigued name. |
109 | * Try to find the disambigued name. |
110 | */ |
110 | */ |
111 | for (cur = node->child; cur; cur = cur->peer) { |
111 | for (cur = node->child; cur; cur = cur->peer) { |
112 | if (strcmp(cur->da_name, name) == 0) |
112 | if (str_cmp(cur->da_name, name) == 0) |
113 | return cur; |
113 | return cur; |
114 | } |
114 | } |
115 | 115 | ||
116 | /* |
116 | /* |
117 | * Disambigued name not found. |
117 | * Disambigued name not found. |
Line 119... | Line 119... | ||
119 | * |
119 | * |
120 | * We need to do this because paths stored in "/aliases" |
120 | * We need to do this because paths stored in "/aliases" |
121 | * are not always fully-qualified. |
121 | * are not always fully-qualified. |
122 | */ |
122 | */ |
123 | for (cur = node->child; cur; cur = cur->peer) { |
123 | for (cur = node->child; cur; cur = cur->peer) { |
124 | if (strcmp(ofw_tree_node_name(cur), name) == 0) |
124 | if (str_cmp(ofw_tree_node_name(cur), name) == 0) |
125 | return cur; |
125 | return cur; |
126 | } |
126 | } |
127 | 127 | ||
128 | return NULL; |
128 | return NULL; |
129 | } |
129 | } |
Line 144... | Line 144... | ||
144 | 144 | ||
145 | for (cur = node->child; cur; cur = cur->peer) { |
145 | for (cur = node->child; cur; cur = cur->peer) { |
146 | prop = ofw_tree_getprop(cur, "device_type"); |
146 | prop = ofw_tree_getprop(cur, "device_type"); |
147 | if (!prop || !prop->value) |
147 | if (!prop || !prop->value) |
148 | continue; |
148 | continue; |
149 | if (strcmp(prop->value, name) == 0) |
149 | if (str_cmp(prop->value, name) == 0) |
150 | return cur; |
150 | return cur; |
151 | } |
151 | } |
152 | 152 | ||
153 | return NULL; |
153 | return NULL; |
154 | } |
154 | } |
Line 201... | Line 201... | ||
201 | 201 | ||
202 | for (cur = node->peer; cur; cur = cur->peer) { |
202 | for (cur = node->peer; cur; cur = cur->peer) { |
203 | prop = ofw_tree_getprop(cur, "device_type"); |
203 | prop = ofw_tree_getprop(cur, "device_type"); |
204 | if (!prop || !prop->value) |
204 | if (!prop || !prop->value) |
205 | continue; |
205 | continue; |
206 | if (strcmp(prop->value, name) == 0) |
206 | if (str_cmp(prop->value, name) == 0) |
207 | return cur; |
207 | return cur; |
208 | } |
208 | } |
209 | 209 | ||
210 | return NULL; |
210 | return NULL; |
211 | } |
211 | } |
Line 227... | Line 227... | ||
227 | 227 | ||
228 | for (cur = node->peer; cur; cur = cur->peer) { |
228 | for (cur = node->peer; cur; cur = cur->peer) { |
229 | prop = ofw_tree_getprop(cur, "name"); |
229 | prop = ofw_tree_getprop(cur, "name"); |
230 | if (!prop || !prop->value) |
230 | if (!prop || !prop->value) |
231 | continue; |
231 | continue; |
232 | if (strcmp(prop->value, name) == 0) |
232 | if (str_cmp(prop->value, name) == 0) |
233 | return cur; |
233 | return cur; |
234 | } |
234 | } |
235 | 235 | ||
236 | return NULL; |
236 | return NULL; |
237 | } |
237 | } |
Line 250... | Line 250... | ||
250 | index_t i, j; |
250 | index_t i, j; |
251 | 251 | ||
252 | if (path[0] != '/') |
252 | if (path[0] != '/') |
253 | return NULL; |
253 | return NULL; |
254 | 254 | ||
255 | for (i = 1; i < str_size(path) && node; i = j + 1) { |
255 | for (i = 1; (i < str_size(path)) && (node); i = j + 1) { |
256 | for (j = i; j < str_size(path) && path[j] != '/'; j++) |
256 | for (j = i; (j < str_size(path)) && (path[j] != '/'); j++); |
257 | ; |
257 | |
258 | if (i == j) /* skip extra slashes */ |
258 | /* Skip extra slashes */ |
- | 259 | if (i == j) |
|
259 | continue; |
260 | continue; |
260 | 261 | ||
261 | memcpy(buf, &path[i], j - i); |
262 | memcpy(buf, &path[i], j - i); |
262 | buf[j - i] = '\0'; |
263 | buf[j - i] = 0; |
263 | node = ofw_tree_find_child(node, buf); |
264 | node = ofw_tree_find_child(node, buf); |
264 | } |
265 | } |
265 | 266 | ||
266 | return node; |
267 | return node; |
267 | } |
268 | } |