From: Jeff King Date: Tue, 02 Feb 2021 09:54:21 GMT Subject: Re: [PATCH v2 10/14] unix-socket: elimiate static unix_stream_socket() helper function Message-ID: In-Reply-To: On Mon, Feb 01, 2021 at 07:45:43PM +0000, Jeff Hostetler via GitGitGadget wrote: > From: Jeff Hostetler > > The static helper function `unix_stream_socket()` calls `die()`. This is not > appropriate for all callers. Eliminate the wrapper function and move the > existing error handling to the callers in preparation for adapting specific > callers. Thanks, this looks good. > -static int unix_stream_socket(void) > -{ > - int fd = socket(AF_UNIX, SOCK_STREAM, 0); > - if (fd < 0) > - die_errno("unable to create socket"); > - return fd; > -} This could become a one-liner: return socket(AF_UNIX, SOCK_STREAM, 0); to keep the details abstracted. But it's local to this file, the callers are already necessarily full of bsd-socket arcana, and it's not like the magic words there have ever changed in 30+ years. Putting it inline seems quite reasonable. :) -Peff