Skip to content

Commit 1e803c7

Browse files
committed
add more comments
1 parent cfdbeda commit 1e803c7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/request.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
#include "zmalloc.h"
3737
#include "request.h"
3838

39-
39+
/* useful symbols:
40+
* '*' and '$' states are:3
41+
* '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';states are 2
42+
*/
4043
//==============================DFA states=================================//
4144
unsigned char _table[256]={
4245
/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
@@ -112,7 +115,7 @@ int req_state_len(struct request *req,char *sb)
112115
return STATE_FAIL;
113116
default:
114117
if(first==1){
115-
/* the first symbol is not '*'*/
118+
/* the first symbol is not '*' or '$'*/
116119
if(_table[(unsigned char)c]!=3)
117120
return STATE_FAIL;
118121
}else{
@@ -152,7 +155,7 @@ int request_parse(struct request *req)
152155
/*parse argv len*/
153156
memset(sb,0,BUF_SIZE);
154157
if(req_state_len(req,sb)!=STATE_CONTINUE){
155-
fprintf(stderr,"argv_len format ***ERROR***,packet:%s",sb);
158+
fprintf(stderr,"argv's length format ***ERROR***,packet:%s",sb);
156159
return 0;
157160
}
158161
argv_len=atoi(sb);

0 commit comments

Comments
 (0)