On Sun, Mar 20, 2016 at 9:31 AM, Michael Paquier <michael.paquier@xxxxxxxxx> wrote: > And the patch attached gives the following output: > With title: > =# \watch 1 > Watch every 1s Sun Mar 20 22:28:38 2016 > popo > a > --- > 1 > (1 row) > > And without title: > Watch every 1s Sun Mar 20 22:29:31 2016 > > a > --- > 1 > (1 row) And does everybody agree that this is a desirable change? As for the patch itself, you could replace all this: + /* + * Take into account any title present in the user setup as a part of + * what is printed for each iteration by using it as a header. + */ + if (myopt.title) + { + title_len = strlen(myopt.title); + title = pg_malloc(title_len + 50); + head_title = pg_strdup(myopt.title); + } + else + { + title_len = 0; + title = pg_malloc(50); + head_title = pg_strdup(""); + } ...with: head_title = pg_strdup(myopt.title != NULL ? myopt.title : ""); title_len = strlen(head_title); title = pg_malloc(title_len + 50); Better yet, include the + 50 in title_len, and then you don't need to reference the number 50 again further down. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general