Avoid gcc warning.
[adu.git] / adu.h
diff --git a/adu.h b/adu.h
index 509c0a2248ea392decce4e2891a6c89606d34cc3..83c3c664daa2fcfc4acea3e40e225834baef4638 100644 (file)
--- a/adu.h
+++ b/adu.h
@@ -4,7 +4,7 @@
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
-/** \file adu.h Global definitions. */
+/** \file adu.h \brief Global definitions. */
 
 #include <sys/stat.h>
 #include <fcntl.h>
 #endif
 /** \endcond */
 
+/**
+ * Wrapper for isspace.
+ * NetBSD needs this.
+ */
+/*
+ * The values should be cast to an unsigned char first, then to int.
+ * Why? Because the isdigit (as do all other is/to functions/macros)
+ * expect a number from 0 upto and including 255 as their (int) argument.
+ * Because char is signed on most systems, casting it to int immediately
+ * gives the functions an argument between -128 and 127 (inclusive),
+ * which they will use as an array index, and which will thus fail
+ * horribly for characters which have their most significant bit set.
+ */
+#define adu_isspace(c) isspace((int)(unsigned char)(c))
+
 /**
  * Write a log message to a dynamically allocated string.
  *
@@ -134,12 +149,14 @@ enum dir_table_columns {
        NUM_DT_COLUMNS
 };
 
-extern uint32_t num_uids;
 extern struct osl_table *dir_table;
 
 /** The adu command line options. */
 extern struct gengetopt_args_info conf;
 
+/** Computed database dir. */
+extern char *database_dir;
+
 /**
  * The select command line options.
  *
@@ -158,7 +175,7 @@ extern struct select_args_info select_conf;
  *
  * \sa osl_compare_func, osl_hash_compare().
  */
-static inline int uint64_compare(const struct osl_object *obj1,
+_static_inline_ int uint64_compare(const struct osl_object *obj1,
                const struct osl_object *obj2)
 {
        uint64_t d1 = read_u64((const char *)obj1->data);
@@ -181,7 +198,7 @@ static inline int uint64_compare(const struct osl_object *obj1,
  * equal, the address of \a obj1 and \a obj2 are compared. So this compare function
  * returns zero if and only if \a obj1 and \a obj2 point to the same memory area.
  */
-static inline int size_compare(const struct osl_object *obj1, const struct osl_object *obj2)
+_static_inline_ int size_compare(const struct osl_object *obj1, const struct osl_object *obj2)
 {
        uint64_t d1 = *(uint64_t *)obj1->data;
        uint64_t d2 = *(uint64_t *)obj2->data;
@@ -197,7 +214,6 @@ static inline int size_compare(const struct osl_object *obj1, const struct osl_o
 __printf_2_3 void __log(int, const char*, ...);
 int open_dir_table(int create);
 void check_signals(void);
-void close_all_tables(void);
 /* create.c */
 int com_create(void);