Petr Kulhavy
2017-05-17 13:58:39 UTC
TLV_PRIORITY1 and TLV_PRIORITY2 cases in do_set_action() use the same repeated
piece of generic code for setting one-value parameter. Remove the duplicated
code and let both cases use the same code.
Signed-off-by: Petr Kulhavy <***@jikos.cz>
---
pmc.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/pmc.c b/pmc.c
index 261f2a2..cefa771 100644
--- a/pmc.c
+++ b/pmc.c
@@ -515,14 +515,6 @@ static void do_set_action(int action, int index, char *str)
}
switch (code) {
case TLV_PRIORITY1:
- cnt = sscanf(str, " %*s %*s %hhu", &mtd.val);
- if (cnt != 1) {
- fprintf(stderr, "%s SET needs 1 value\n",
- idtab[index].name);
- break;
- }
- pmc_send_set_action(pmc, code, &mtd, sizeof(mtd));
- break;
case TLV_PRIORITY2:
cnt = sscanf(str, " %*s %*s %hhu", &mtd.val);
if (cnt != 1) {
piece of generic code for setting one-value parameter. Remove the duplicated
code and let both cases use the same code.
Signed-off-by: Petr Kulhavy <***@jikos.cz>
---
pmc.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/pmc.c b/pmc.c
index 261f2a2..cefa771 100644
--- a/pmc.c
+++ b/pmc.c
@@ -515,14 +515,6 @@ static void do_set_action(int action, int index, char *str)
}
switch (code) {
case TLV_PRIORITY1:
- cnt = sscanf(str, " %*s %*s %hhu", &mtd.val);
- if (cnt != 1) {
- fprintf(stderr, "%s SET needs 1 value\n",
- idtab[index].name);
- break;
- }
- pmc_send_set_action(pmc, code, &mtd, sizeof(mtd));
- break;
case TLV_PRIORITY2:
cnt = sscanf(str, " %*s %*s %hhu", &mtd.val);
if (cnt != 1) {
--
2.7.4
2.7.4