equal
deleted
inserted
replaced
41 * Our sock_stream on_read handler |
41 * Our sock_stream on_read handler |
42 */ |
42 */ |
43 static void line_proto_on_read (struct sock_stream *sock, void *arg) |
43 static void line_proto_on_read (struct sock_stream *sock, void *arg) |
44 { |
44 { |
45 struct line_proto *lp = arg; |
45 struct line_proto *lp = arg; |
46 const char *line; |
46 char *line; |
47 |
47 |
48 // sanity-check |
48 // sanity-check |
49 assert(lp->tail_offset < lp->buf_len); |
49 assert(lp->tail_offset < lp->buf_len); |
50 |
50 |
51 do { |
51 do { |
153 |
153 |
154 // return offset to next line, as set in loop based on delim |
154 // return offset to next line, as set in loop based on delim |
155 return next; |
155 return next; |
156 } |
156 } |
157 |
157 |
158 err_t line_proto_read (struct line_proto *lp, const char **line_ptr) |
158 err_t line_proto_read (struct line_proto *lp, char **line_ptr) |
159 { |
159 { |
160 // offset to recv() new data into, offset to _parse_line hint, offset to next line from _parse_line |
160 // offset to recv() new data into, offset to _parse_line hint, offset to next line from _parse_line |
161 size_t recv_offset = 0, peek_offset = 0, next_offset = 0; |
161 size_t recv_offset = 0, peek_offset = 0, next_offset = 0; |
162 int ret; |
162 int ret; |
163 |
163 |