[PATCH 0/5] MR1154: tools: Use ARRAY_SIZE instead of open coding it.
From: Michael Stefaniuc <mstefani(a)winehq.org> --- tools/widl/widl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/widl/widl.c b/tools/widl/widl.c index 7b2276b0a41..1a0b57f8f88 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -490,7 +490,7 @@ static void init_argv0_dir( const char *argv0 ) static int pathname[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; size_t path_size = PATH_MAX; char *path = xmalloc( path_size ); - if (!sysctl( pathname, sizeof(pathname)/sizeof(pathname[0]), path, &path_size, NULL, 0 )) + if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 )) dir = realpath( path, NULL ); free( path ); #else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1154
From: Michael Stefaniuc <mstefani(a)winehq.org> --- tools/winegcc/winegcc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index ab26adb07e8..e40aa9270ec 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -660,7 +660,7 @@ static void init_argv0_dir( const char *argv0 ) static int pathname[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; size_t path_size = PATH_MAX; char *path = xmalloc( path_size ); - if (!sysctl( pathname, sizeof(pathname)/sizeof(pathname[0]), path, &path_size, NULL, 0 )) + if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 )) dir = realpath( path, NULL ); free( path ); #else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1154
From: Michael Stefaniuc <mstefani(a)winehq.org> --- tools/wmc/wmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/wmc/wmc.c b/tools/wmc/wmc.c index 7ca339fbeef..f5ff7abcdf9 100644 --- a/tools/wmc/wmc.c +++ b/tools/wmc/wmc.c @@ -158,7 +158,7 @@ static void init_argv0_dir( const char *argv0 ) static int pathname[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; size_t path_size = PATH_MAX; char *path = xmalloc( path_size ); - if (!sysctl( pathname, sizeof(pathname)/sizeof(pathname[0]), path, &path_size, NULL, 0 )) + if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 )) dir = realpath( path, NULL ); free( path ); #else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1154
From: Michael Stefaniuc <mstefani(a)winehq.org> --- tools/wrc/wrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c index c3dfa418571..2448fff11eb 100644 --- a/tools/wrc/wrc.c +++ b/tools/wrc/wrc.c @@ -302,7 +302,7 @@ static void init_argv0_dir( const char *argv0 ) static int pathname[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; size_t path_size = PATH_MAX; char *path = xmalloc( path_size ); - if (!sysctl( pathname, sizeof(pathname)/sizeof(pathname[0]), path, &path_size, NULL, 0 )) + if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 )) dir = realpath( path, NULL ); free( path ); #else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1154
From: Michael Stefaniuc <mstefani(a)winehq.org> --- tools/makedep.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index 7100cacaf86..2395835ff72 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -402,7 +402,7 @@ static const char *normalize_arch( const char *arch ) { "arm" }, }; - for (i = 0; i < sizeof(map) / sizeof(map[0]); i++) + for (i = 0; i < ARRAY_SIZE(map); i++) for (j = 0; map[i][j]; j++) if (!strncmp( arch, map[i][j], strlen(map[i][j]) )) return map[i][0]; @@ -1201,7 +1201,7 @@ static struct file *load_file( const char *name ) input_file_name = file->name; input_line = 0; - for (i = 0; i < sizeof(parse_functions) / sizeof(parse_functions[0]); i++) + for (i = 0; i < ARRAY_SIZE(parse_functions); i++) { if (!strendswith( name, parse_functions[i].ext )) continue; parse_functions[i].parse( file, f ); @@ -2585,7 +2585,7 @@ static void output_uninstall_rules( struct makefile *make ) } strarray_qsort( &uninstall_dirs, cmp_string_length ); output( "\t-rmdir" ); - for (i = 0; i < sizeof(dirs_order)/sizeof(dirs_order[0]); i++) + for (i = 0; i < ARRAY_SIZE(dirs_order); i++) { for (j = 0; j < uninstall_dirs.count; j++) { @@ -2767,7 +2767,7 @@ static void output_source_idl( struct makefile *make, struct incl_file *source, if (find_include_file( make, strmake( "%s.h", obj ))) source->file->flags |= FLAG_IDL_HEADER; if (!source->file->flags) return; - for (i = 0; i < sizeof(idl_outputs) / sizeof(idl_outputs[0]); i++) + for (i = 0; i < ARRAY_SIZE(idl_outputs); i++) { if (!(source->file->flags & idl_outputs[i].flag)) continue; dest = strmake( "%s%s", obj, idl_outputs[i].ext ); @@ -4026,7 +4026,7 @@ static void output_silent_rules(void) unsigned int i; output( "V = 0\n" ); - for (i = 0; i < sizeof(cmds) / sizeof(cmds[0]); i++) + for (i = 0; i < ARRAY_SIZE(cmds); i++) { output( "quiet_%s = $(quiet_%s_$(V))\n", cmds[i], cmds[i] ); output( "quiet_%s_0 = @echo \" %-5s \" $@;\n", cmds[i], cmds[i] ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1154
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125370 Your paranoid android. === debian11 (build log) === Task: Could not create the win32 wineprefix: Failed to disable the crash dialogs: Task: WineTest did not produce the win32 report
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1154
participants (4)
-
Huw Davies (@huw) -
Marvin -
Michael Stefaniuc -
Michael Stefaniuc (@mstefani)