Skip to content

Commit

Permalink
pmc: optimize duplicated code in do_set_action()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Brainik authored and richardcochran committed May 21, 2017
1 parent 78d2a32 commit a216b11
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a216b11

Please sign in to comment.