Revert "item: make kdbus_items_get_str() work with KDBUS_ITEM_NAME_{ADD,REMOVE,CHANGE}"
authorDaniel Mack <daniel@zonque.org>
Wed, 1 Oct 2014 17:11:26 +0000 (19:11 +0200)
committerDaniel Mack <daniel@zonque.org>
Wed, 1 Oct 2014 17:24:31 +0000 (19:24 +0200)
Turns out the only use case for this tweak can be done differently.
Remove it for now. We might eventually switch to a more generic
implementation that hands out the entire item.

This reverts commit c9f76f807f366625f446053a4d529995aca9b37a.

item.c

diff --git a/item.c b/item.c
index f0fe14523c7cb2982b325f5a1f1074084a2eb293..abcd1ada55673a5f3432e5aa85b132dce9991bcc 100644 (file)
--- a/item.c
+++ b/item.c
@@ -227,7 +227,7 @@ int kdbus_items_validate(const struct kdbus_item *items, size_t items_size)
  *
  * This function walks a list of items and searches for items of type
  * @item_type. If it finds exactly one such item, @str_ret will be set to
- * the string member of the item.
+ * the .str member of the item.
  *
  * Return: 0 if the item was found exactly once, -EEXIST if the item was
  * found more than once, and -EBADMSG if there was no item of the given type.
@@ -243,21 +243,8 @@ int kdbus_items_get_str(const struct kdbus_item *items, size_t items_size,
                        if (n)
                                return -EEXIST;
 
-                       switch (item_type) {
-                       case KDBUS_ITEM_NAME_ADD:
-                       case KDBUS_ITEM_NAME_REMOVE:
-                       case KDBUS_ITEM_NAME_CHANGE:
-                               n = (const char *) &item->name_change.name;
-                               break;
-
-                       case KDBUS_ITEM_NAME:
-                       case KDBUS_ITEM_MAKE_NAME:
-                               n = item->str;
-                               break;
-
-                       default:
-                               break;
-                       }
+                       n = item->str;
+                       continue;
                }
        }