Changeset: a40457ed7dc8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a40457ed7dc8
Modified Files:
        gdk/gdk.h
        gdk/gdk_atoms.h
        monetdb5/mal/mal_exception.c
        sql/backends/monet5/vaults/bam/bam_globals.h
        sql/backends/monet5/vaults/bam/mykstring.h
        sql/storage/store.c
Branch: linear-hashing
Log Message:

Add some function attributes and place others better to avoid repetition.


diffs (223 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1519,9 +1519,7 @@ gdk_export void GDKclrerr(void);
  * @end itemize
  */
 /* NOTE: `p' is evaluated after a possible upgrade of the heap */
-static inline gdk_return Tputvalue(BAT *b, BUN p, const void *v, bool copyall)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 Tputvalue(BAT *b, BUN p, const void *v, bool copyall)
 {
        if (b->tvarsized && b->ttype) {
@@ -1561,18 +1559,14 @@ Tputvalue(BAT *b, BUN p, const void *v, 
        return GDK_SUCCEED;
 }
 
-static inline gdk_return tfastins_nocheck(BAT *b, BUN p, const void *v, int s)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 tfastins_nocheck(BAT *b, BUN p, const void *v, int s)
 {
        b->theap.free += s;
        return Tputvalue(b, p, v, false);
 }
 
-static inline gdk_return bunfastapp_nocheck(BAT *b, BUN p, const void *v, int 
ts)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 bunfastapp_nocheck(BAT *b, BUN p, const void *v, int ts)
 {
        gdk_return rc;
@@ -1582,9 +1576,7 @@ bunfastapp_nocheck(BAT *b, BUN p, const 
        return rc;
 }
 
-static inline gdk_return bunfastapp(BAT *b, const void *v)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 bunfastapp(BAT *b, const void *v)
 {
        if (BATcount(b) >= BATcapacity(b)) {
@@ -1610,9 +1602,7 @@ bunfastapp(BAT *b, const void *v)
          ((TYPE *) (b)->theap.base)[(b)->batCount++] = * (const TYPE *) (v), \
          GDK_SUCCEED)) 
 
-static inline gdk_return tfastins_nocheckVAR(BAT *b, BUN p, const void *v, int 
s)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 tfastins_nocheckVAR(BAT *b, BUN p, const void *v, int s)
 {
        var_t d;
@@ -1647,9 +1637,7 @@ tfastins_nocheckVAR(BAT *b, BUN p, const
        return GDK_SUCCEED;
 }
 
-static inline gdk_return bunfastapp_nocheckVAR(BAT *b, BUN p, const void *v, 
int ts)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 bunfastapp_nocheckVAR(BAT *b, BUN p, const void *v, int ts)
 {
        gdk_return rc;
@@ -1659,9 +1647,7 @@ bunfastapp_nocheckVAR(BAT *b, BUN p, con
        return rc;
 }
 
-static inline gdk_return bunfastappVAR(BAT *b, const void *v)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 bunfastappVAR(BAT *b, const void *v)
 {
        if (BATcount(b) >= BATcapacity(b)) {
diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h
--- a/gdk/gdk_atoms.h
+++ b/gdk/gdk_atoms.h
@@ -284,9 +284,7 @@ gdk_export const ptr ptr_nil;
  * this would make the commit tremendously complicated.
  */
 
-static inline gdk_return ATOMputVAR(int type, Heap *heap, var_t *dst, const 
void *src)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 ATOMputVAR(int type, Heap *heap, var_t *dst, const void *src)
 {
        assert(BATatoms[type].atomPut != NULL);
@@ -327,9 +325,7 @@ ATOMputFIX(int type, void *dst, const vo
        }
 }
 
-static inline gdk_return ATOMreplaceVAR(int type, Heap *heap, var_t *dst, 
const void *src)
-       __attribute__((__warn_unused_result__));
-static inline gdk_return
+static inline gdk_return __attribute__((__warn_unused_result__))
 ATOMreplaceVAR(int type, Heap *heap, var_t *dst, const void *src)
 {
        var_t loc = *dst;
@@ -383,25 +379,25 @@ ATOMreplaceVAR(int type, Heap *heap, var
  * though we have to take corrective action to ensure that str(nil) is
  * the smallest value of the domain.
  */
-static inline bool
+static inline bool __attribute__((__pure__))
 strEQ(const char *l, const char *r)
 {
        return strcmp(l, r) == 0;
 }
 
-static inline bool
+static inline bool __attribute__((__pure__))
 strNil(const char *s)
 {
        return s == NULL || *s == '\200';
 }
 
-static inline size_t
+static inline size_t __attribute__((__pure__))
 strLen(const char *s)
 {
        return strNil(s) ? 2 : strlen(s) + 1;
 }
 
-static inline int
+static inline int __attribute__((__pure__))
 strCmp(const char *l, const char *r)
 {
        return strNil(r)
@@ -428,15 +424,7 @@ VarHeapValRaw(const void *b, BUN p, int 
 
 #define VarHeapVal(b,p,w)      ((size_t) VarHeapValRaw(b,p,w))
 
-/*
- * @- Hash Function
- * The string hash function is a very simple hash function that xors
- * and rotates all characters together. It is optimized to process 2
- * characters at a time (adding 16-bits to the hash value each
- * iteration).
- */
-static BUN strHash(const char *key) __attribute__((__pure__));
-static inline BUN
+static inline BUN __attribute__((__pure__))
 strHash(const char *key)
 {
        BUN y = 0;
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -50,10 +50,7 @@ static char *M5OutOfMemory = MAL_MALLOC_
  * showException such that they share the same code, because reuse
  * is good.
  */
-static str createExceptionInternal(enum malexception type, const char *fcn, 
const char *format, va_list ap)
-       __attribute__((__format__(__printf__, 3, 0)))
-       __attribute__((__returns_nonnull__));
-static str
+static str __attribute__((__format__(__printf__, 3, 0), __returns_nonnull__))
 createExceptionInternal(enum malexception type, const char *fcn, const char 
*format, va_list ap)
 {
        char *message, local[GDKMAXERRLEN];
@@ -151,11 +148,7 @@ freeException(str msg)
  * showScriptException such that they share the same code, because reuse
  * is good.
  */
-static str
-createMalExceptionInternal(MalBlkPtr mb, int pc, enum malexception type, char 
*prev, const char *format, va_list ap)
-       __attribute__((__format__(__printf__, 5, 0)))
-       __attribute__((__returns_nonnull__));
-static str
+static str __attribute__((__format__(__printf__, 5, 0), __returns_nonnull__))
 createMalExceptionInternal(MalBlkPtr mb, int pc, enum malexception type, char 
*prev, const char *format, va_list ap)
 {
        char buf[GDKMAXERRLEN];
diff --git a/sql/backends/monet5/vaults/bam/bam_globals.h 
b/sql/backends/monet5/vaults/bam/bam_globals.h
--- a/sql/backends/monet5/vaults/bam/bam_globals.h
+++ b/sql/backends/monet5/vaults/bam/bam_globals.h
@@ -58,10 +58,7 @@ prepare_for_log(const char *str, bit fir
 }
 
 /* Function that adds a hash before every printed line, so Mtest.py will not 
notice a difference in whether or not we are debugging. Arguments to this 
function should  */
-static inline int
-hash_fprintf(FILE *f, const char *format, ...) __attribute__ ((format (printf, 
2, 3) ));
-
-static inline int
+static inline int __attribute__ ((format (printf, 2, 3) ))
 hash_fprintf(FILE *f, const char *format, ...) {
        va_list arg;
        int done;
diff --git a/sql/backends/monet5/vaults/bam/mykstring.h 
b/sql/backends/monet5/vaults/bam/mykstring.h
--- a/sql/backends/monet5/vaults/bam/mykstring.h
+++ b/sql/backends/monet5/vaults/bam/mykstring.h
@@ -36,9 +36,8 @@ typedef struct {
 
 #define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, 
(x)|=(x)>>8, (x)|=(x)>>16, ++(x))
 
-static int ksprintf(kstring_t *s, const char *fmt, ...)
-       __attribute__((__format__(__printf__, 2, 3)));
-static int ksprintf(kstring_t *s, const char *fmt, ...)
+static int __attribute__((__format__(__printf__, 2, 3)))
+ksprintf(kstring_t *s, const char *fmt, ...)
 {
        va_list ap;
        int l;
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2378,9 +2378,7 @@ store_unlock(void)
 
 // Helper function for tar_write_header.
 // Our stream.h makes sure __attribute__ exists.
-static void tar_write_header_field(char **cursor_ptr, size_t size, const char 
*fmt, ...)
-       __attribute__((__format__(__printf__, 3, 4)));
-static void
+static void __attribute__((__format__(__printf__, 3, 4)))
 tar_write_header_field(char **cursor_ptr, size_t size, const char *fmt, ...)
 {
        va_list ap;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to