| From: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com> |
| Subject: | Support isEmptyStringInfo |
| Date: | 2022-03-23 12:32:44 |
| Message-ID: | CAExHW5ssGYXcZovQBWYu=7YqcWB7iVwn1cVp_9MKzwgi3mNyYg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi All,
We have (StringInfo::len == 0) checks at many places. I thought it
would be better to wrap that into a function isEmptyStringInfo() to
make those checks more readable and also abstract the logic to check
emptiness of a StringInfo. I think this will be useful to extensions
outside core which also have these checks. They won't need to worry
about that logic/code being changed in future; rare but not impossible
case.
Probably we should have similar support for PQExpBuffer as well, which
will be more useful to hide the internals of PQExpBuffer from client
code. But I haven't included those changes in this patch. I can do
that if hackers like the idea.
--
Best Wishes,
Ashutosh Bapat
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-isEmptyStringInfo-to-check-whether-StringInfo-has-no.patch | text/x-patch | 5.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2022-03-23 12:35:43 | Re: Support isEmptyStringInfo |
| Previous Message | Robert Haas | 2022-03-23 12:32:39 | Re: make MaxBackends available in _PG_init |