| From: | Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Refactor textToQualifiedNameList() |
| Date: | 2018-08-29 04:50:39 |
| Message-ID: | 20180829135039.ade8db2872553bd206aa147a@sraoss.co.jp |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, 28 Aug 2018 11:49:26 +0900 (Tokyo Standard Time)
Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> At Fri, 24 Aug 2018 20:44:12 +0900, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote in <20180824204412(dot)150979ae6b283ddb639f93f6(at)sraoss(dot)co(dot)jp>
> > When working on other patch[1], I found there are almost same
> > functions, texttoQualifiedNameList() and stringToQualifiedNameList().
> > The only difference is the argument type, text or char*. I don't know
> > why these functions are defined seperately, but I think the former
> > function can be rewritten using the latter code as the attached patch.
> > Is this reasonable fix?
>
> The functions were introduced within a month for different
> objectives in March and April, 2002. I supppose that they are
> intentionally added as separate functions for simplicitly since
> the second one is apparent CnP'ed from the first one.
>
> commit 5f4745adf4fb2a1f933b25d7a2bc72b39fa9edfd
> commit 52200befd04b9fa71da83231c808764867079226
Thank you for your comments. I also looked at the commit history.
stringToQNL is added after textToQNL as a static function originally,
but this is now public and reffered from other modules, too. So, I
propose to mote this from regproc.c to verlena.c and rewrite textToQNL
to call stringToQNL. This is just for reducing redundancy of the code.
Attached is the updated patch.
> Returning to the patch, the downside of it is that textToQNL
> makes an extra and unused copy of the parameter string. (It's a
> kind of bug that it is forgetting to free rawname.)
I also fixed to free rawname in the texttoQNL.
Regards,
--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
| Attachment | Content-Type | Size |
|---|---|---|
| refactor_textToQualifiedNameList_v2.patch | text/x-diff | 4.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2018-08-29 06:17:23 | Re: BUG #15346: Replica fails to start after the crash |
| Previous Message | Sand Stone | 2018-08-29 04:44:07 | Re: dsa_allocate() faliure |