File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 53
53
#define COPY_STRING_FIELD (fldname ) \
54
54
(newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
55
55
56
+ /* Copy a field that is an inline array */
57
+ #define COPY_ARRAY_FIELD (fldname ) \
58
+ memcpy(newnode->fldname, from->fldname, sizeof(newnode->fldname))
59
+
56
60
/* Copy a field that is a pointer to a simple palloc'd object of size sz */
57
61
#define COPY_POINTER_FIELD (fldname , sz ) \
58
62
do { \
@@ -4947,10 +4951,9 @@ _copyForeignKeyCacheInfo(const ForeignKeyCacheInfo *from)
4947
4951
COPY_SCALAR_FIELD (conrelid );
4948
4952
COPY_SCALAR_FIELD (confrelid );
4949
4953
COPY_SCALAR_FIELD (nkeys );
4950
- /* COPY_SCALAR_FIELD might work for these, but let's not assume that */
4951
- memcpy (newnode -> conkey , from -> conkey , sizeof (newnode -> conkey ));
4952
- memcpy (newnode -> confkey , from -> confkey , sizeof (newnode -> confkey ));
4953
- memcpy (newnode -> conpfeqop , from -> conpfeqop , sizeof (newnode -> conpfeqop ));
4954
+ COPY_ARRAY_FIELD (conkey );
4955
+ COPY_ARRAY_FIELD (confkey );
4956
+ COPY_ARRAY_FIELD (conpfeqop );
4954
4957
4955
4958
return newnode ;
4956
4959
}
Original file line number Diff line number Diff line change 74
74
#define equalstr (a , b ) \
75
75
(((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
76
76
77
+ /* Compare a field that is an inline array */
78
+ #define COMPARE_ARRAY_FIELD (fldname ) \
79
+ do { \
80
+ if (memcmp(a->fldname, b->fldname, sizeof(a->fldname)) != 0) \
81
+ return false; \
82
+ } while (0)
83
+
77
84
/* Compare a field that is a pointer to a simple palloc'd object of size sz */
78
85
#define COMPARE_POINTER_FIELD (fldname , sz ) \
79
86
do { \
You can’t perform that action at this time.
0 commit comments