From a8573c4bfa41a407247fb1cae56cf9dfb890d6ca Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 22 Jul 2013 20:36:58 +0200 Subject: [PATCH] com_setatt(): Use get_attribute_bitnum_by_name(). We have this nice helper, so don't open-code it. --- attribute.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/attribute.c b/attribute.c index 96b54c99..a28de635 100644 --- a/attribute.c +++ b/attribute.c @@ -226,10 +226,10 @@ static void com_setatt_callback(__a_unused int fd, const struct osl_object *quer int ret; size_t len; struct osl_object obj; - struct osl_row *row; for (p = query->data; p < (char *)query->data + query->size; p += len + 1) { char c; + unsigned char bitnum; len = strlen(p); ret = -E_ATTR_SYNTAX; @@ -239,19 +239,13 @@ static void com_setatt_callback(__a_unused int fd, const struct osl_object *quer if (c != '+' && c != '-') break; p[len - 1] = '\0'; - obj.data = p; - obj.size = len + 1; - ret = osl(osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row)); - if (ret < 0) - goto out; - ret = osl(osl_get_object(attribute_table, row, ATTCOL_BITNUM, - &obj)); + ret = get_attribute_bitnum_by_name(p, &bitnum); if (ret < 0) goto out; if (c == '+') - add_mask |= (1UL << *(unsigned char *)obj.data); + add_mask |= (1UL << bitnum); else - del_mask |= (1UL << *(unsigned char *)obj.data); + del_mask |= (1UL << bitnum); } ret = -E_ATTR_SYNTAX; if (!add_mask && !del_mask) -- 2.39.5