From: Wouter Wijngaards Date: Tue, 20 Feb 2007 15:47:27 +0000 (+0000) Subject: locks.h doxygen not enforced, it looks bad. X-Git-Tag: release-0.1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a87e39c8e6e9d94e037762f12fbcc18f1d82ee4e;p=thirdparty%2Funbound.git locks.h doxygen not enforced, it looks bad. no lint and doxygen on yacc and lex generated files. added doc to config_file.h git-svn-id: file:///svn/unbound/trunk@132 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/Makefile.in b/Makefile.in index 1f79b20aa..f2dd6604e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -115,7 +115,7 @@ realclean: clean rm -f Makefile lint: - $Qfor i in $(sort $(ALL_SRC)); do \ + $Qfor i in $(filter-out util/configparser.c,$(filter-out util/configlexer.c,$(sort $(ALL_SRC)))); do \ echo lint $$i; \ $(LINT) $(LINTFLAGS) -I. -I$(srcdir) -I$(ldnsdir)/include $(srcdir)/$$i ; \ if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ diff --git a/doc/unbound.doxygen b/doc/unbound.doxygen index baf13faaf..73f9470e7 100644 --- a/doc/unbound.doxygen +++ b/doc/unbound.doxygen @@ -480,7 +480,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = ./build ./compat +EXCLUDE = ./build ./compat util/configparser.c util/configparser.h util/configlexer.c util/locks.h # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded diff --git a/testdata/01-doc.tpkg b/testdata/01-doc.tpkg index 500d5ec91..a2e5f0e5c 100644 Binary files a/testdata/01-doc.tpkg and b/testdata/01-doc.tpkg differ diff --git a/util/config_file.c b/util/config_file.c index 7894a810d..df6d34e03 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -45,11 +45,19 @@ #include "util/configyyrename.h" #include "util/config_file.h" #include "util/configparser.h" +/** global config during parsing */ struct config_parser_state* cfg_parser = 0; -extern FILE* ub_c_in, *ub_c_out; +/** lex in file */ +extern FILE* ub_c_in; +/** lex out file */ +extern FILE* ub_c_out; +/** the yacc lex generated parse function */ int ub_c_parse(void); +/** the lexer function */ int ub_c_lex(void); +/** wrap function */ int ub_c_wrap(void); +/** print error with file and line number */ void ub_c_error(const char *message); struct config_file* @@ -85,6 +93,7 @@ config_delete(struct config_file* cfg) free(cfg); } +/** print error with file and line number */ void ub_c_error_va_list(const char *fmt, va_list args) { cfg_parser->errors++; @@ -94,6 +103,7 @@ void ub_c_error_va_list(const char *fmt, va_list args) fprintf(stderr, "\n"); } +/** print error with file and line number */ void ub_c_error_msg(const char* fmt, ...) { va_list args; diff --git a/util/config_file.h b/util/config_file.h index 99223653a..f11c65a4f 100644 --- a/util/config_file.h +++ b/util/config_file.h @@ -83,15 +83,21 @@ void config_delete(struct config_file* config); * Used during options parsing */ struct config_parser_state { + /** name of file being parser */ char* filename; + /** line number in the file, starts at 1 */ int line; + /** number of errors encountered */ int errors; + /** the result of parsing is stored here. */ struct config_file* cfg; }; +/** global config parser object used during config parsing */ extern struct config_parser_state* cfg_parser; -/* parsing helpers */ +/** parsing helpers: print error with file and line numbers. */ void ub_c_error(const char* msg); +/** parsing helpers: print error with file and line numbers. */ void ub_c_error_msg(const char* fmt, ...) ATTR_FORMAT(printf, 1, 2); #endif /* UTIL_CONFIG_FILE_H */ diff --git a/util/locks.h b/util/locks.h index bb8eaef66..317187cf7 100644 --- a/util/locks.h +++ b/util/locks.h @@ -78,24 +78,17 @@ typedef pthread_rwlock_t lock_rw_t; /** small front for pthread init func, NULL is default attrs. */ #define lock_rw_init(lock) LOCKRET(pthread_rwlock_init(lock, NULL)) -/** free up the lock. must be unlocked. */ #define lock_rw_destroy(lock) LOCKRET(pthread_rwlock_destroy(lock)) -/** acquire a read lock */ #define lock_rw_rdlock(lock) LOCKRET(pthread_rwlock_rdlock(lock)) -/** acquire a write lock */ #define lock_rw_wrlock(lock) LOCKRET(pthread_rwlock_wrlock(lock)) -/** unlock previously acquired read or write lock */ #define lock_rw_unlock(lock) LOCKRET(pthread_rwlock_unlock(lock)) /** use pthread mutex for basic lock */ typedef pthread_mutex_t lock_basic_t; /** small front for pthread init func, NULL is default attrs. */ #define lock_basic_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) -/** free up the lock. must be unlocked. */ #define lock_basic_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) -/** acquire lock. This may block indefinetely. */ #define lock_basic_lock(lock) LOCKRET(pthread_mutex_lock(lock)) -/** unlock acquired lock. */ #define lock_basic_unlock(lock) LOCKRET(pthread_mutex_unlock(lock)) #ifndef HAVE_PTHREAD_SPINLOCK_T @@ -103,11 +96,8 @@ typedef pthread_mutex_t lock_basic_t; typedef pthread_mutex_t lock_quick_t; /** small front for pthread init func, NULL is default attrs. */ #define lock_quick_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) -/** free up the lock. must be unlocked. */ #define lock_quick_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) -/** acquire lock. may block. */ #define lock_quick_lock(lock) LOCKRET(pthread_mutex_lock(lock)) -/** unlock acquired lock. */ #define lock_quick_unlock(lock) LOCKRET(pthread_mutex_unlock(lock)) #else /* HAVE_PTHREAD_SPINLOCK_T */ @@ -121,11 +111,8 @@ typedef pthread_spinlock_t lock_quick_t; * spinlocks are not supported on all pthread platforms. */ #define lock_quick_init(lock) LOCKRET(pthread_spin_init(lock, PTHREAD_PROCESS_PRIVATE)) -/** free up the lock. must be unlocked. */ #define lock_quick_destroy(lock) LOCKRET(pthread_spin_destroy(lock)) -/** acquire lock. This may block indefinetely, and will spin. */ #define lock_quick_lock(lock) LOCKRET(pthread_spin_lock(lock)) -/** unlock acquired lock. */ #define lock_quick_unlock(lock) LOCKRET(pthread_spin_unlock(lock)) #endif /* HAVE SPINLOCK */ @@ -140,37 +127,24 @@ typedef pthread_t ub_thread_t; /******************* SOLARIS THREADS ************************/ typedef rwlock_t lock_rw_t; -/** create thisprocessonly lock */ #define lock_rw_init(lock) LOCKRET(rwlock_init(lock, USYNC_THREAD, NULL)) -/** destroy it */ #define lock_rw_destroy(lock) LOCKRET(rwlock_destroy(lock)) -/** lock read */ #define lock_rw_rdlock(lock) LOCKRET(rw_rdlock(lock)) -/** lock write */ #define lock_rw_wrlock(lock) LOCKRET(rw_wrlock(lock)) -/** unlock */ #define lock_rw_unlock(lock) LOCKRET(rw_unlock(lock)) /** use basic mutex */ typedef mutex_t lock_basic_t; -/** create */ #define lock_basic_init(lock) LOCKRET(mutex_init(lock, USYNC_THREAD, NULL)) -/** destroy */ #define lock_basic_destroy(lock) LOCKRET(mutex_destroy(lock)) -/** lock */ #define lock_basic_lock(lock) LOCKRET(mutex_lock(lock)) -/** unlock */ #define lock_basic_unlock(lock) LOCKRET(mutex_unlock(lock)) /** No spinlocks in solaris threads API. Use a mutex. */ typedef mutex_t lock_quick_t; -/** create */ #define lock_quick_init(lock) LOCKRET(mutex_init(lock, USYNC_THREAD, NULL)) -/** destroy */ #define lock_quick_destroy(lock) LOCKRET(mutex_destroy(lock)) -/** lock */ #define lock_quick_lock(lock) LOCKRET(mutex_lock(lock)) -/** unlock */ #define lock_quick_unlock(lock) LOCKRET(mutex_unlock(lock)) /** Thread creation, create a default thread. */ @@ -182,37 +156,24 @@ typedef thread_t ub_thread_t; /******************* NO THREADS ************************/ /** In case there is no thread support, define locks to do nothing */ typedef int lock_rw_t; -/** does nothing */ #define lock_rw_init(lock) /* nop */ -/** does nothing */ #define lock_rw_destroy(lock) /* nop */ -/** does nothing */ #define lock_rw_rdlock(lock) /* nop */ -/** does nothing */ #define lock_rw_wrlock(lock) /* nop */ -/** does nothing */ #define lock_rw_unlock(lock) /* nop */ /** define locks to do nothing */ typedef int lock_basic_t; -/** does nothing */ #define lock_basic_init(lock) /* nop */ -/** does nothing */ #define lock_basic_destroy(lock) /* nop */ -/** does nothing */ #define lock_basic_lock(lock) /* nop */ -/** does nothing */ #define lock_basic_unlock(lock) /* nop */ /** define locks to do nothing */ typedef int lock_quick_t; -/** does nothing */ #define lock_quick_init(lock) /* nop */ -/** does nothing */ #define lock_quick_destroy(lock) /* nop */ -/** does nothing */ #define lock_quick_lock(lock) /* nop */ -/** does nothing */ #define lock_quick_unlock(lock) /* nop */ /** Thread creation, threads do not exist */