[PATCH 0/1] MR549: ws2_32: Move the #ifdef into the function
Signed-off-by: Andr�� Zwing <nerv(a)dawncrow.de> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/549
From: André Zwing <nerv(a)dawncrow.de> Signed-off-by: André Zwing <nerv(a)dawncrow.de> --- dlls/ws2_32/unixlib.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dlls/ws2_32/unixlib.c b/dlls/ws2_32/unixlib.c index 0625c5c72ce..30e1970716b 100644 --- a/dlls/ws2_32/unixlib.c +++ b/dlls/ws2_32/unixlib.c @@ -890,10 +890,10 @@ static NTSTATUS unix_gethostbyaddr( void *args ) } -#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 static NTSTATUS unix_gethostbyname( void *args ) { struct gethostbyname_params *params = args; +#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 struct hostent stack_host, *unix_host; char *unix_buffer, *new_buffer; int unix_size = 1024; @@ -921,11 +921,7 @@ static NTSTATUS unix_gethostbyname( void *args ) free( unix_buffer ); return ret; -} #else -static NTSTATUS unix_gethostbyname( void *args ) -{ - struct gethostbyname_params *params = args; struct hostent *unix_host; int ret; @@ -942,8 +938,8 @@ static NTSTATUS unix_gethostbyname( void *args ) pthread_mutex_unlock( &host_mutex ); return ret; -} #endif +} static NTSTATUS unix_gethostname( void *args ) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/549
I guess, although this doesn't seem like a clear improvement to me.
On Wed Jul 27 16:52:37 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: ``` I guess, although this doesn't seem like a clear improvement to me. _______________________________________________ wine-gitlab mailing list -- wine-gitlab(a)winehq.org To unsubscribe send an email to wine-gitlab-leave(a)winehq.org ``` It's more consistent with the rest of the file and IMHO it improves readability and reduces LOC slightly. But I know what you mean.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/549#note_5113
On 7/27/22 12:18, André Zwing (@AndreRH) wrote:
On Wed Jul 27 16:52:37 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: ``` I guess, although this doesn't seem like a clear improvement to me. _______________________________________________ wine-gitlab mailing list -- wine-gitlab(a)winehq.org To unsubscribe send an email to wine-gitlab-leave(a)winehq.org ``` It's more consistent with the rest of the file and IMHO it improves readability and reduces LOC slightly. But I know what you mean.
I guess I don't see this kind of thing as improving readability. When almost none of the function is shared it's easier to parse as a single self-contained unit. That's just my take, though...
On Wed Jul 27 17:37:41 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: ``` On 7/27/22 12:18, Andr�� Zwing (@AndreRH) wrote:
On Wed Jul 27 16:52:37 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: \`\`\` I guess, although this doesn't seem like a clear improvement to me. _______________________________________________ wine-gitlab mailing list -- wine-gitlab(a)winehq.org To unsubscribe send an email to wine-gitlab-leave(a)winehq.org \`\`\` It's more consistent with the rest of the file and IMHO it improves readability and reduces LOC slightly. But I know what you mean.
I guess I don't see this kind of thing as improving readability. When almost none of the function is shared it's easier to parse as a single self-contained unit. That's just my take, though... _______________________________________________ wine-gitlab mailing list -- wine-gitlab(a)winehq.org To unsubscribe send an email to wine-gitlab-leave(a)winehq.org ``` In my opinion having the ifdef inside the function improves readability and is a bit more idiomatic, because you don't have to consider whether the function signature is different based on preprocessor conditions, and you know it's only the implementation that differs.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/549#note_5116
On Wed Jul 27 18:12:52 2022 +0000, Derek Lesho wrote:
In my opinion having the ifdef inside the function improves readability and is a bit more idiomatic, because you don't have to consider whether the function signature is different based on preprocessor conditions, and you know it's only the implementation that differs. Whether it warrants a patch though, ���� resolving with "undecided whether improvement"
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/549#note_5847
This merge request was closed by Alexandre Julliard. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/549
resolving with "undecided whether improvement"
Both approaches are OK, neither is objectively better, so it's a matter of taste. For such cases, the rule is that you do it the way you like in your own code, and you refrain from changing other people's code. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/549#note_5946
participants (4)
-
Alexandre Julliard (@julliard) -
André Zwing -
Derek Lesho (@dlesho) -
Zebediah Figura