summaryrefslogtreecommitdiff
path: root/udev_utils.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-07-15 19:01:01 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-07-15 19:01:01 +0200
commit9aeded07a0229a64cdc1ec8999ad2e2c58e4d38f (patch)
tree16cedde802f3763cb5710516cc547c41ac3d9691 /udev_utils.c
parent84654a89135a0044f1abc380b1bd5f8c29637120 (diff)
name_list: rename loop_name -> name_loop
Diffstat (limited to 'udev_utils.c')
-rw-r--r--udev_utils.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/udev_utils.c b/udev_utils.c
index e2f84cf24a..e1630b67b5 100644
--- a/udev_utils.c
+++ b/udev_utils.c
@@ -56,68 +56,68 @@ int log_priority(const char *priority)
struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort)
{
- struct name_entry *loop_name;
- struct name_entry *new_name;
+ struct name_entry *name_loop;
+ struct name_entry *name_new;
- list_for_each_entry(loop_name, name_list, node) {
- /* avoid doubles */
- if (strcmp(loop_name->name, name) == 0) {
+ /* avoid duplicate entries */
+ list_for_each_entry(name_loop, name_list, node) {
+ if (strcmp(name_loop->name, name) == 0) {
dbg("'%s' is already in the list", name);
- return loop_name;
+ return name_loop;
}
}
if (sort)
- list_for_each_entry(loop_name, name_list, node) {
- if (sort && strcmp(loop_name->name, name) > 0)
+ list_for_each_entry(name_loop, name_list, node) {
+ if (strcmp(name_loop->name, name) > 0)
break;
}
- new_name = malloc(sizeof(struct name_entry));
- if (new_name == NULL)
+ name_new = malloc(sizeof(struct name_entry));
+ if (name_new == NULL)
return NULL;
- strlcpy(new_name->name, name, sizeof(new_name->name));
- dbg("adding '%s'", new_name->name);
- list_add_tail(&new_name->node, &loop_name->node);
+ strlcpy(name_new->name, name, sizeof(name_new->name));
+ dbg("adding '%s'", name_new->name);
+ list_add_tail(&name_new->node, &name_loop->node);
- return new_name;
+ return name_new;
}
struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value)
{
- struct name_entry *loop_name;
- struct name_entry *new_name;
-
- list_for_each_entry(loop_name, name_list, node) {
- if (strncmp(loop_name->name, key, strlen(key)) == 0) {
- dbg("key already present '%s', replace it", loop_name->name);
- snprintf(loop_name->name, sizeof(loop_name->name), "%s=%s", key, value);
- loop_name->name[sizeof(loop_name->name)-1] = '\0';
- return loop_name;
+ struct name_entry *name_loop;
+ struct name_entry *name_new;
+
+ list_for_each_entry(name_loop, name_list, node) {
+ if (strncmp(name_loop->name, key, strlen(key)) == 0) {
+ dbg("key already present '%s', replace it", name_loop->name);
+ snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value);
+ name_loop->name[sizeof(name_loop->name)-1] = '\0';
+ return name_loop;
}
}
- new_name = malloc(sizeof(struct name_entry));
- if (new_name == NULL)
+ name_new = malloc(sizeof(struct name_entry));
+ if (name_new == NULL)
return NULL;
- snprintf(new_name->name, sizeof(new_name->name), "%s=%s", key, value);
- new_name->name[sizeof(new_name->name)-1] = '\0';
- dbg("adding '%s'", new_name->name);
- list_add_tail(&new_name->node, &loop_name->node);
+ snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value);
+ name_new->name[sizeof(name_new->name)-1] = '\0';
+ dbg("adding '%s'", name_new->name);
+ list_add_tail(&name_new->node, &name_loop->node);
- return new_name;
+ return name_new;
}
int name_list_key_remove(struct list_head *name_list, const char *key)
{
struct name_entry *name_loop;
- struct name_entry *temp_loop;
+ struct name_entry *name_tmp;
size_t keylen = strlen(key);
int retval = 0;
- list_for_each_entry_safe(name_loop, temp_loop, name_list, node) {
+ list_for_each_entry_safe(name_loop, name_tmp, name_list, node) {
if (strncmp(name_loop->name, key, keylen) != 0)
continue;
if (name_loop->name[keylen] != '=')
@@ -133,9 +133,9 @@ int name_list_key_remove(struct list_head *name_list, const char *key)
void name_list_cleanup(struct list_head *name_list)
{
struct name_entry *name_loop;
- struct name_entry *temp_loop;
+ struct name_entry *name_tmp;
- list_for_each_entry_safe(name_loop, temp_loop, name_list, node) {
+ list_for_each_entry_safe(name_loop, name_tmp, name_list, node) {
list_del(&name_loop->node);
free(name_loop);
}