Changeset: 733120dc1be5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/733120dc1be5
Modified Files:
gdk/gdk.h
monetdb5/modules/atoms/str.c
monetdb5/modules/mal/pp_hash.c
sql/backends/monet5/sql_bincopyconvert.c
sql/storage/bat/bat_logger.c
Branch: default
Log Message:
Cleanup + introduced a bunch of PRI* macros in the style of <inttypes.h>.
Introduced macros are PRIdLNG, PRIuLNG, PRIxLNG, PRIoLNG, PRIuOID,
PRIuBUN.
diffs (138 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1296,16 +1296,18 @@ typedef union {
} inet4;
typedef union {
#ifdef HAVE_HGE
- hge align; /* force alignment, only used for equality */
+ uint128_t align; /* force alignment, only used for equality */
#else
- lng align[2]; /* force alignment, not otherwise used */
+ uint64_t align[2]; /* force alignment, not otherwise used */
#endif
- uint8_t hex[16];
+ uint8_t hex[16] __attribute__((__nonstring__));
} inet6;
#define SIZEOF_OID SIZEOF_SIZE_T
typedef size_t oid;
-#define OIDFMT "%zu"
+/* macro in the style of <inttypes.h> for formatting oid */
+#define PRIuOID "zu"
+#define OIDFMT "%" PRIuOID
typedef int bat; /* Index into BBP */
typedef void *ptr; /* Internal coding of types */
@@ -1320,9 +1322,9 @@ typedef char *str;
typedef union {
#ifdef HAVE_HGE
- hge h; /* force alignment, only used for equality */
+ uint128_t h; /* force alignment, only used for equality */
#else
- lng l[2]; /* force alignment, not otherwise used */
+ uint64_t l[2]; /* force alignment, not otherwise used */
#endif
uint8_t u[UUID_SIZE] __attribute__((__nonstring__));
} uuid;
@@ -1336,8 +1338,12 @@ gdk_export size_t blobsize(size_t nitems
#define SIZEOF_LNG 8
#define LL_CONSTANT(val) INT64_C(val)
-#define LLFMT "%" PRId64
-#define ULLFMT "%" PRIu64
+#define PRIdLNG PRId64
+#define PRIuLNG PRIu64
+#define PRIxLNG PRIx64
+#define PRIoLNG PRIo64
+#define LLFMT "%" PRIdLNG
+#define ULLFMT "%" PRIuLNG
#define LLSCN "%" SCNd64
#define ULLSCN "%" SCNu64
@@ -1367,12 +1373,8 @@ typedef oid var_t; /* type used for hea
typedef oid BUN; /* BUN position */
#define SIZEOF_BUN SIZEOF_OID
+#define PRIuBUN PRIuOID
#define BUNFMT OIDFMT
-/* alternatively:
-typedef size_t BUN;
-#define SIZEOF_BUN SIZEOF_SIZE_T
-#define BUNFMT "%zu"
-*/
#if SIZEOF_BUN == SIZEOF_INT
#define BUN_NONE ((BUN) INT_MAX)
#else
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1965,7 +1965,7 @@ scan_loop_strselect(BAT *rl, BATiter *li
rl->tnil = false;
}
- TRC_DEBUG(ALGO, "%s, l=%s #%zu [%s], cl=%s #%zu, time="LLFMT"usecs)\n",
+ TRC_DEBUG(ALGO, "%s, l=%s #"BUNFMT" [%s], cl=%s #"BUNFMT",
time="LLFMT"usecs)\n",
fname,
BATgetId(li->b), li->count, ATOMname(li->b->ttype),
lci->s ? BATgetId(lci->s) : "NULL", lci->ncand,
@@ -2217,7 +2217,7 @@ nested_loop_strjoin(BAT *rl, BAT *rr, BA
}
}
- TRC_DEBUG(ALGO, "(%s, %s, l=%s #%zu [%s], r=%s #%zu [%s], cl=%s #%zu,
cr=%s #%zu, time="LLFMT"usecs)\n",
+ TRC_DEBUG(ALGO, "(%s, %s, l=%s #"BUNFMT" [%s], r=%s #"BUNFMT" [%s],
cl=%s #"BUNFMT", cr=%s #"BUNFMT", time="LLFMT"usecs)\n",
fname, "nested_loop_strjoin",
BATgetId(li->b), li->count, ATOMname(li->b->ttype),
BATgetId(ri->b), ri->count, ATOMname(ri->b->ttype),
@@ -2460,7 +2460,7 @@ bigram_strjoin(BAT *rl, BAT *rr, BATiter
ma_close(&ta_state);
- TRC_DEBUG(ALGO, "(%s, %s, l=%s #%zu [%s], r=%s #%zu [%s], cl=%s #%zu,
cr=%s #%zu, time="LLFMT"usecs)\n",
+ TRC_DEBUG(ALGO, "(%s, %s, l=%s #"BUNFMT" [%s], r=%s #"BUNFMT" [%s],
cl=%s #"BUNFMT", cr=%s #"BUNFMT", time="LLFMT"usecs)\n",
fname, "bigram_strjoin",
BATgetId(li->b), li->count, ATOMname(li->b->ttype),
BATgetId(ri->b), ri->count, ATOMname(ri->b->ttype),
diff --git a/monetdb5/modules/mal/pp_hash.c b/monetdb5/modules/mal/pp_hash.c
--- a/monetdb5/modules/mal/pp_hash.c
+++ b/monetdb5/modules/mal/pp_hash.c
@@ -152,10 +152,10 @@ ht_create(int type, size_t size, hash_ta
{ \
gid g = (gid) ATOMIC_GET(&ht->gids[i]); \
if (g) { \
- mnstr_printf(fdout, "#| %7lld ", (long long)
i); \
+ mnstr_printf(fdout, "#| %7"PRIuOID" ", i); \
if (ht->pgids) \
- mnstr_printf(fdout, "| %7lld ", (long
long) ht->pgids[g]); \
- mnstr_printf(fdout, "| %7lld ", (long long)
(g-1)); \
+ mnstr_printf(fdout, "| %7"PRIuOID" ",
ht->pgids[g]); \
+ mnstr_printf(fdout, "| %7"PRIuOID" ", g - 1); \
if (is_##Type##_nil(vals[g])) \
mnstr_printf(fdout, "| NIL\n"); \
else \
diff --git a/sql/backends/monet5/sql_bincopyconvert.c
b/sql/backends/monet5/sql_bincopyconvert.c
--- a/sql/backends/monet5/sql_bincopyconvert.c
+++ b/sql/backends/monet5/sql_bincopyconvert.c
@@ -569,7 +569,7 @@ load_zero_terminated_text(BAT *bat, stre
size_t consumed;
msg = insert_nul_terminated_values(&state, &bs->buf[bs->pos],
bs->len - bs->pos, &consumed);
#ifdef DEBUG_PRINTFS
- fprintf(stderr, "# consumed %zu, left_over=%zu,
batcount=%zu\n", consumed, state.left_over, BATcount(bat));
+ fprintf(stderr, "# consumed %zu, left_over=%zu,
batcount="BUNFMT"\n", consumed, state.left_over, BATcount(bat));
#endif
if (msg != MAL_SUCCEED)
goto end;
diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -1233,7 +1233,7 @@ snapshot_immediate_copy_file(stream *pla
GDKerror("Reading bytes of component %s failed: %s",
path, mnstr_peek_error(s));
goto end;
} else if (bytes_read < (ssize_t) chunk) {
- GDKerror("Read only %zu/%zu bytes of component %s: %s",
(size_t) bytes_read, chunk, path, mnstr_peek_error(s));
+ GDKerror("Read only %zd/%zu bytes of component %s: %s",
bytes_read, chunk, path, mnstr_peek_error(s));
goto end;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]