File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 5353#define COPY_STRING_FIELD (fldname ) \
5454 (newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
5555
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+
5660/* Copy a field that is a pointer to a simple palloc'd object of size sz */
5761#define COPY_POINTER_FIELD (fldname , sz ) \
5862 do { \
@@ -4947,10 +4951,9 @@ _copyForeignKeyCacheInfo(const ForeignKeyCacheInfo *from)
49474951 COPY_SCALAR_FIELD (conrelid );
49484952 COPY_SCALAR_FIELD (confrelid );
49494953 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 );
49544957
49554958 return newnode ;
49564959}
Original file line number Diff line number Diff line change 7474#define equalstr (a , b ) \
7575 (((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
7676
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+
7784/* Compare a field that is a pointer to a simple palloc'd object of size sz */
7885#define COMPARE_POINTER_FIELD (fldname , sz ) \
7986 do { \
You can’t perform that action at this time.
0 commit comments