Re: [HACKERS] utils/misc: Simplify search of end of argv in save_ps_display_args()
Alexander Kuleshov wrote: > Hello, > > Attached patch provides trivial simplification of the search of end of > the argv[] area by replacing for() loop with calculation based on > argc. Uhm. Doesn't this break the very same thing that the comment explains it's doing? -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] utils/misc: Simplify search of end of argv in save_ps_display_args()
Hello, Attached patch provides trivial simplification of the search of end of the argv[] area by replacing for() loop with calculation based on argc. diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c index 892a810..d8f2105 100644 --- a/src/backend/utils/misc/ps_status.c +++ b/src/backend/utils/misc/ps_status.c @@ -134,11 +134,8 @@ save_ps_display_args(int argc, char **argv) /* * check for contiguous argv strings */ - for (i = 0; i < argc; i++) - { - if (i == 0 || end_of_area + 1 == argv[i]) -end_of_area = argv[i] + strlen(argv[i]); - } + if (argc) + end_of_area = argv[argc - 1] + strlen(argv[argc - 1]); if (end_of_area == NULL) /* probably can't happen? */ { -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers