Message ID | 1471437202-6134-1-git-send-email-zhangchen.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> /* > * Returns > * 0: SocketReadState is not ready > * 1: SocketReadState is ready > * otherwise error occurs > */ > int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size) it seems you need to fix the returns and comments too. simply, just remove the 'return 1;' would be OK ? because the callers only concern about the error case.
On 08/18/2016 09:31 AM, Li Zhijian wrote: >> /* >> * Returns >> * 0: SocketReadState is not ready >> * 1: SocketReadState is ready >> * otherwise error occurs >> */ >> int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size) > > it seems you need to fix the returns and comments too. > simply, just remove the 'return 1;' would be OK ? > because the callers only concern about the error case. OK, I got your point, will fix it in V2.
diff --git a/net/net.c b/net/net.c index a8e2e6b..8f3237e 100644 --- a/net/net.c +++ b/net/net.c @@ -1636,7 +1636,9 @@ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size) if (rs->finalize) { rs->finalize(rs); } - return 1; + if (!size) { + return 1; + } } break; }