Re: arrayfuncs: fix read of uninitialized mem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: arrayfuncs: fix read of uninitialized mem
Дата
Msg-id 3328.1095257892@sss.pgh.pa.us
обсуждение исходный текст
Ответ на arrayfuncs: fix read of uninitialized mem  (Neil Conway <neilc@samurai.com>)
Ответы Re: arrayfuncs: fix read of uninitialized mem
Список pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> I fixed it by initializing dims_str[0] to '\0' circa line 1018 in
> current sources. While doing so I couldn't resist the temptation to fix
> a few of arrayfunc.c's crimes against good programming practise, so the
> attached patch includes some additional cosmetic improvements.

I dislike what you did at lines 983-1012 (replace a local variable by
possibly-many stores into an array).  Also, as long as we're fixing
unreadable code, how about (line 1019)

    for (i = j = 0, k = 1; i < ndim; k *= dims[i++], j += k);

becomes

     for (i = j = 0, k = 1; i < ndim; i++)
        k *= dims[i], j += k;

or some such.  The empty loop body is a mistake waiting to happen.

Looks fine to me otherwise.

            regards, tom lane

В списке pgsql-patches по дате отправления:

Предыдущее
От: Mahmoud Taghizadeh
Дата:
Сообщение: Again!! locale per column for postgreSQL
Следующее
От: Karel Zak
Дата:
Сообщение: Re: Again!! locale per column for postgreSQL