Skip to content

Commit

Permalink
Use fewer magic numbers in code.
Browse files Browse the repository at this point in the history
The length of the reserve and stats commands shouldn't be specified as magic
numbers in code, they should use the definitions in beanstalkd.h.
  • Loading branch information
Keith Rarick committed Sep 21, 2007
1 parent 5106780 commit fdca114
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions beanstalkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ do_cmd(conn c)
break;
case OP_RESERVE:
/* don't allow trailing garbage */
if (c->cmd_len != 9) return conn_close(c);
if (c->cmd_len != CSTRSZ(CMD_RESERVE) + 2) return conn_close(c);

fprintf(stderr, "got reserve cmd: %s\n", c->cmd);

Expand All @@ -206,7 +206,7 @@ do_cmd(conn c)
break;
case OP_STATS:
/* don't allow trailing garbage */
if (c->cmd_len != 7) return conn_close(c);
if (c->cmd_len != CSTRSZ(CMD_STATS) + 2) return conn_close(c);
warn("got stats command");
conn_close(c);
break;
Expand Down

0 comments on commit fdca114

Please sign in to comment.