Skip to contentSkip to conversation

Patch to improve readability of sock_rcvlowat() - comments wanted...

DISCUSSION Ronald Bultje 2 participants 2 messages May 7, 2001 – May 8, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 9 lines · On 2001.05.08 01:04:57 +0200 Jesper Juhl wrote:

static inline int sock_rcvlowat(struct sock *sk, int waitall, int len)

{
         int r = len;
         if (!waitall)
                 r = min(sk->rcvlowat, len);
         return max(1,r);
}

return max(1, waitall ? len : min(sk->rcvlowat, len));

Although I doubt this is more readable... :-)

--
Ronald

#2 lore raw
In reply to a message not in the archive
Quoted 12 lines · Ronald Bultje
Quoted 8 lines · On 2001.05.08 01:04:57 +0200 Jesper Juhl wrote:

static inline int sock_rcvlowat(struct sock *sk, int waitall, int len)

{
         int r = len;
         if (!waitall)
                 r = min(sk->rcvlowat, len);
         return max(1,r);
}
Quoted 4 lines

return max(1, waitall ? len : min(sk->rcvlowat, len));

Although I doubt this is more readable... :-)

IMO your version is less readable than the 4-liner above, and the code it generates is a lot bigger than both the original and the proposed replacement - but thank you for the suggestion...

- Jesper Juhl - [email protected]