Re: [PATCH] Refactoring of LWLock tranches
От | Amit Kapila |
---|---|
Тема | Re: [PATCH] Refactoring of LWLock tranches |
Дата | |
Msg-id | CAA4eK1JPc75fRtrZVcqG2TYCK9_c7j4nCLme+yc8o6wqG_mP6g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH] Refactoring of LWLock tranches (Amit Kapila <amit.kapila16@gmail.com>) |
Ответы |
Re: [PATCH] Refactoring of LWLock tranches
|
Список | pgsql-hackers |
On Sat, Jan 30, 2016 at 12:23 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
On Fri, Jan 29, 2016 at 6:55 PM, Alexander Korotkov <a.korotkov@postgrespro.ru> wrote:Also couple of minor comments from me.I think this+ StrNCpy(LWLockTrancheRequestArray[LWLockTrancheRequestsCount].tranche_name, tranche_name, strlen(tranche_name) + 1);should be+ StrNCpy(LWLockTrancheRequestArray[LWLockTrancheRequestsCount].tranche_name, tranche_name, sizeof(LWLockTrancheRequestArray[LWLockTrancheRequestsCount].tranche_name));I think you are right, otherwise it might try to copy more, howaboutStrNCpy(LWLockTrancheRequestArray[LWLockTrancheRequestsCount].tranche_name, tranche_name, Min (strlen(tranche_name) + 1, sizeof(LWLockTrancheRequestArray[LWLockTrancheRequestsCount].tranche_name)));
Changed as per your suggestion, rather than using Min,
because I saw most code places uses directly sizeof for
StrNCpy(), so lets be consistent.
And as far as I know english "it's" should be "its" in the sentence below.+ from <function>_PG_init</>. Tranche repersents an array of LWLocks and
+ can be accessed by it's name. First parameter <literal>tranche_name</>Right, will change.
Fixed.
Вложения
В списке pgsql-hackers по дате отправления: