Code

utils/proto: Let all unmarshal functions accept strings instead of strbufs.
[sysdb.git] / src / include / utils / error.h
index e170a7d5e85109406a15af21d4247daa27cd0083..49034eb2544381061583c33d4174e9fb9089e80e 100644 (file)
 #ifndef SDB_UTILS_ERROR_H
 #define SDB_UTILS_ERROR_H 1
 
+#include <stdarg.h>
 #include <stddef.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/* max length of any error message */
-#ifndef SDB_MAX_ERROR
-#      define SDB_MAX_ERROR 4096
-#endif /* ! SDB_MAX_ERROR */
-
 /* On Linux systems and possibly others, this should be the same as the LOG_
  * constants defined by syslog. */
 enum {
@@ -76,7 +72,7 @@ void
 sdb_error_set_logger(int (*f)(int, const char *));
 
 /*
- * sdb_log:
+ * sdb_log, sdb_vlog:
  * Log the specified message. The string will be formatted in printf-style
  * using the specified format and arguments and logged with the specified
  * priority. In addition, the error message will be stored as the current
@@ -85,7 +81,10 @@ sdb_error_set_logger(int (*f)(int, const char *));
  * on configuration, try a clean shut-down of the process.
  */
 int
-sdb_log(int prio, const char *fmt, ...);
+sdb_log(int prio, const char *fmt, ...)
+               __attribute__((format(printf, 2, 3)));
+int
+sdb_vlog(int prio, const char *fmt, va_list ap);
 
 /*
  * sdb_error_set, sdb_error_append:
@@ -94,9 +93,11 @@ sdb_log(int prio, const char *fmt, ...);
  * be done.
  */
 int
-sdb_error_set(const char *fmt, ...);
+sdb_error_set(const char *fmt, ...)
+               __attribute__((format(printf, 1, 2)));
 int
-sdb_error_append(const char *fmt, ...);
+sdb_error_append(const char *fmt, ...)
+               __attribute__((format(printf, 1, 2)));
 
 /*
  * sdb_error_chomp: