pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedCode not compiling since 19d5486 due to concatenate operators in macros
3+ messages / 3 participants
[nested] [flat]
* Code not compiling since 19d5486 due to concatenate operators in macros
@ 2013-10-28 08:10 Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Paquier @ 2013-10-28 08:10 UTC (permalink / raw)
To: pgsql-odbc
Hi all,
(resending patch as it looks that it was stuck in administration queue
of this ML...)
I noticed this morning that ODBC does not compile correctly since
commit 19d5486 due to some macros using concatenate operators used
with CORR_STRCPY and CORR_VALCPY in psqlodbc.c and connection.c.
In the case of CORR_VALCPY the macro simply needs to copy a field one
by one, and for CORR_STRCPY only a string is copied, so concatenate
operators are not necessary IMO. Please find a patch fixing that by
removing the unnecessary operators.
Regards,
--
Michael
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Attachments:
20131028_pgodbc_concatenate_ops.patch (text/x-diff, 1.3K) download
commit 579c1b6d4b8cac59d6a4efd7273f447faeadc9cc
Author: Michael Paquier <mpaquier@vmware.com>
Date: Mon Oct 28 14:27:39 2013 +0900
Remove concatenate operators to fix compilation errors
Concatenate operators do not really make sense in this case as each field
is copied one by one.
diff --git a/connection.c b/connection.c
index d30f551..c2cfda5 100644
--- a/connection.c
+++ b/connection.c
@@ -308,8 +308,8 @@ CC_conninfo_init(ConnInfo *conninfo, UInt4 option)
copy_globals(&(conninfo->drivers), &globals);
}
-#define CORR_STRCPY(item) strncpy_null(ci->##item, sci->##item, sizeof(ci->##item))
-#define CORR_VALCPY(item) (ci->##item = sci->##item)
+#define CORR_STRCPY(item) strncpy_null(ci->item, sci->item, sizeof(ci->item))
+#define CORR_VALCPY(item) (ci->item = sci->item)
void
CC_copy_conninfo(ConnInfo *ci, const ConnInfo *sci)
diff --git a/psqlodbc.c b/psqlodbc.c
index 89f277d..08c92b5 100644
--- a/psqlodbc.c
+++ b/psqlodbc.c
@@ -97,8 +97,8 @@ int initialize_global_cs(void)
return 0;
}
-#define CORR_STRCPY(item) strncpy_null(to->##item, from->##item, sizeof(to->##item))
-#define CORR_VALCPY(item) (to->##item = from->##item)
+#define CORR_STRCPY(item) strncpy_null(to->item, from->item, sizeof(to->item))
+#define CORR_VALCPY(item) (to->item = from->item)
void copy_globals(GLOBAL_VALUES *to, const GLOBAL_VALUES *from)
{
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Code not compiling since 19d5486 due to concatenate operators in macros
@ 2013-10-28 10:53 Heikki Linnakangas <hlinnakangas@vmware.com>
parent: Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Heikki Linnakangas @ 2013-10-28 10:53 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: pgsql-odbc
On 28.10.2013 10:10, Michael Paquier wrote:
> Hi all,
> (resending patch as it looks that it was stuck in administration queue
> of this ML...)
>
> I noticed this morning that ODBC does not compile correctly since
> commit 19d5486 due to some macros using concatenate operators used
> with CORR_STRCPY and CORR_VALCPY in psqlodbc.c and connection.c.
>
> In the case of CORR_VALCPY the macro simply needs to copy a field one
> by one, and for CORR_STRCPY only a string is copied, so concatenate
> operators are not necessary IMO. Please find a patch fixing that by
> removing the unnecessary operators.
Thanks, committed to fix the build.
Hiroshi, I didn't understand the point of that change in the first
place. The old memcpy method of copying these objects seemed fine to me.
Can you elaborate?
PS. I just noticed that the email address in your git commit messages is
misspelled, "inoue@tpf.co.p". Check your .gitconfig file.
- Heikki
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Code not compiling since 19d5486 due to concatenate operators in macros
@ 2013-10-29 01:10 Hiroshi Inoue <inoue@tpf.co.jp>
parent: Heikki Linnakangas <hlinnakangas@vmware.com>
0 siblings, 0 replies; 3+ messages in thread
From: Hiroshi Inoue @ 2013-10-29 01:10 UTC (permalink / raw)
To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Michael Paquier <michael.paquier@gmail.com>; pgsql-odbc
(2013/10/28 19:53), Heikki Linnakangas wrote:
> On 28.10.2013 10:10, Michael Paquier wrote:
>> Hi all,
>> (resending patch as it looks that it was stuck in administration queue
>> of this ML...)
>>
>> I noticed this morning that ODBC does not compile correctly since
>> commit 19d5486 due to some macros using concatenate operators used
>> with CORR_STRCPY and CORR_VALCPY in psqlodbc.c and connection.c.
>>
>> In the case of CORR_VALCPY the macro simply needs to copy a field one
>> by one, and for CORR_STRCPY only a string is copied, so concatenate
>> operators are not necessary IMO. Please find a patch fixing that by
>> removing the unnecessary operators.
>
> Thanks, committed to fix the build.
>
> Hiroshi, I didn't understand the point of that change in the first
> place. The old memcpy method of copying these objects seemed fine to me.
> Can you elaborate?
password member of ConnInfo struct was changed to be of pgNAME type.
pgNAME type essetially means a pointer. It's dangerous to simply
copy a pointer to another one and I forgot the operation needed for
password member of pgNAME type and it caused a double free crash later.
I dislike the double free bug and changed CC_copy_conninfo to copy each
item one by one for future changes.
> PS. I just noticed that the email address in your git commit messages is
> misspelled, "inoue@tpf.co.p". Check your .gitconfig file.
Oops you are right.
Thanks.
regards,
Hiroshi Inoue
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2013-10-29 01:10 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-10-28 08:10 Code not compiling since 19d5486 due to concatenate operators in macros Michael Paquier <michael.paquier@gmail.com>
2013-10-28 10:53 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-10-29 01:10 ` Hiroshi Inoue <inoue@tpf.co.jp>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox