Changeset: dd91c0a48cc7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dd91c0a48cc7
Modified Files:
geom/lib/libgeom.h
geom/monetdb5/geom.c
Branch: geo
Log Message:
grafted some changes from commit 3b2401cc353f related to the usage of the
FLEXIBLE_ARRAY_MEMBER macro
diffs (41 lines):
diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -110,7 +110,7 @@ libgeom_export const char *geom_type2str
typedef struct wkb {
int len;
int srid;
- char data[1];
+ char data[FLEXIBLE_ARRAY_MEMBER];
} wkb;
typedef struct wkba {
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -1877,8 +1877,8 @@ static int mbr_isnil(mbr *m) {
static var_t wkb_size(size_t len) {
if (len == ~(size_t) 0)
len = 0;
- assert(sizeof(wkb) - 1 + len <= VAR_MAX);
- return (var_t) (sizeof(wkb) - 1 + len);
+ assert(offsetof(wkb, data) + len <= VAR_MAX);
+ return (var_t) (offsetof(wkb, data) + len);
}
/* returns the size of variable-sized atom wkba */
@@ -4966,11 +4966,10 @@ BUN wkbHASH(wkb *w) {
}
/* returns a pointer to a null wkb */
+static wkb wkb_nil = {~0};
+
wkb *wkbNULL(void) {
- static wkb nullval;
-
- nullval.len = ~(int) 0;
- return (&nullval);
+ return (&wkb_nil);
}
int wkbCOMP(wkb *l, wkb *r) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list