From 5bc10701fe3992bc08ab1a265265ebca5a9fd472 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Tue, 20 Sep 2011 14:51:02 +0200 Subject: [PATCH] Remove atalk/boolean.h, use stdbool.h instead --- bin/misc/logger_test.c | 2 +- etc/afpd/fce_api.c | 12 ++++++------ etc/afpd/fce_api_internal.h | 4 +++- etc/afpd/fce_util.c | 16 +++++++--------- include/atalk/Makefile.am | 2 +- include/atalk/boolean.h | 36 ------------------------------------ include/atalk/logger.h | 3 +-- libatalk/util/logger.c | 3 +-- 8 files changed, 20 insertions(+), 58 deletions(-) delete mode 100644 include/atalk/boolean.h diff --git a/bin/misc/logger_test.c b/bin/misc/logger_test.c index a968cce3..b3ab7b53 100644 --- a/bin/misc/logger_test.c +++ b/bin/misc/logger_test.c @@ -1,6 +1,6 @@ #include +#include -#include #include int main(int argc, char *argv[]) diff --git a/etc/afpd/fce_api.c b/etc/afpd/fce_api.c index fb7535b6..5c295c60 100644 --- a/etc/afpd/fce_api.c +++ b/etc/afpd/fce_api.c @@ -459,7 +459,7 @@ int fce_register_delete_file( struct path *path ) if (!(fce_ev_enabled & (1 << FCE_FILE_DELETE))) return ret; - ret = register_fce( path->u_name, FALSE, FCE_FILE_DELETE ); + ret = register_fce( path->u_name, false, FCE_FILE_DELETE ); return ret; } @@ -473,7 +473,7 @@ int fce_register_delete_dir( char *name ) if (!(fce_ev_enabled & (1 << FCE_DIR_DELETE))) return ret; - ret = register_fce( name, TRUE, FCE_DIR_DELETE); + ret = register_fce( name, true, FCE_DIR_DELETE); return ret; } @@ -488,7 +488,7 @@ int fce_register_new_dir( struct path *path ) if (!(fce_ev_enabled & (1 << FCE_DIR_CREATE))) return ret; - ret = register_fce( path->u_name, TRUE, FCE_DIR_CREATE ); + ret = register_fce( path->u_name, true, FCE_DIR_CREATE ); return ret; } @@ -504,7 +504,7 @@ int fce_register_new_file( struct path *path ) if (!(fce_ev_enabled & (1 << FCE_FILE_CREATE))) return ret; - ret = register_fce( path->u_name, FALSE, FCE_FILE_CREATE ); + ret = register_fce( path->u_name, false, FCE_FILE_CREATE ); return ret; } @@ -528,7 +528,7 @@ int fce_register_file_modification( struct ofork *ofork ) return AFPERR_MISC; } - ret = register_fce( u_name, FALSE, FCE_FILE_MODIFY ); + ret = register_fce( u_name, false, FCE_FILE_MODIFY ); return ret; } @@ -544,7 +544,7 @@ int fce_register_tm_size(const char *vol, size_t used) return ret; tm_used = used; /* oh what a hack */ - ret = register_fce(vol, FALSE, FCE_TM_SIZE); + ret = register_fce(vol, false, FCE_TM_SIZE); return ret; } diff --git a/etc/afpd/fce_api_internal.h b/etc/afpd/fce_api_internal.h index ff92fdc0..9ed185e5 100644 --- a/etc/afpd/fce_api_internal.h +++ b/etc/afpd/fce_api_internal.h @@ -8,6 +8,8 @@ #ifndef _FCE_API_INTERNAL_H #define _FCE_API_INTERNAL_H +#include + #define FCE_MAX_UDP_SOCKS 5 /* Allow a maximum of udp listeners for file change events */ #define FCE_SOCKET_RETRY_DELAY_S 600 /* Pause this time in s after socket was broken */ #define FCE_PACKET_VERSION 1 @@ -43,7 +45,7 @@ struct fce_close_event { #define PACKET_HDR_LEN (sizeof(struct fce_packet) - FCE_MAX_PATH_LEN) -int fce_handle_coalescation( char *path, int is_dir, int mode ); +bool fce_handle_coalescation( char *path, int is_dir, int mode ); void fce_initialize_history(); diff --git a/etc/afpd/fce_util.c b/etc/afpd/fce_util.c index ad6026f7..8523aa48 100644 --- a/etc/afpd/fce_util.c +++ b/etc/afpd/fce_util.c @@ -24,13 +24,11 @@ #endif /* HAVE_CONFIG_H */ #include - #include #include #include #include - - +#include #include #include #include @@ -96,7 +94,7 @@ void fce_initialize_history() } } -int fce_handle_coalescation( char *path, int is_dir, int mode ) +bool fce_handle_coalescation( char *path, int is_dir, int mode ) { /* These two are used to eval our next index in history */ /* the history is unsorted, speed should not be a problem, length is 10 */ @@ -105,11 +103,11 @@ int fce_handle_coalescation( char *path, int is_dir, int mode ) struct timeval tv; if (coalesce == 0) - return FALSE; + return false; /* After a file creation *ALWAYS* a file modification is produced */ if ((mode == FCE_FILE_CREATE) && (coalesce & FCE_COALESCE_CREATE)) - return TRUE; + return true; /* get timestamp */ gettimeofday(&tv, 0); @@ -140,7 +138,7 @@ int fce_handle_coalescation( char *path, int is_dir, int mode ) if ((coalesce & FCE_COALESCE_CREATE) && (fh->mode == FCE_DIR_CREATE)) { /* Parent dir ? */ if (!strncmp(fh->path, path, strlen(fh->path))) - return TRUE; + return true; } /* If we find a parent dir we should be DELETED we are done */ @@ -149,7 +147,7 @@ int fce_handle_coalescation( char *path, int is_dir, int mode ) && (mode == FCE_FILE_DELETE || mode == FCE_DIR_DELETE)) { /* Parent dir ? */ if (!strncmp(fh->path, path, strlen(fh->path))) - return TRUE; + return true; } /* Detect oldest entry for next new entry */ @@ -166,7 +164,7 @@ int fce_handle_coalescation( char *path, int is_dir, int mode ) strncpy( fce_history_list[oldest_entry_idx].path, path, MAXPATHLEN); /* we have to handle this event */ - return FALSE; + return false; } /* diff --git a/include/atalk/Makefile.am b/include/atalk/Makefile.am index e4939e29..6058e6ec 100644 --- a/include/atalk/Makefile.am +++ b/include/atalk/Makefile.am @@ -2,7 +2,7 @@ atalkincludedir = $(includedir)/atalk atalkinclude_HEADERS = \ - adouble.h vfs.h aep.h afp.h asp.h atp.h boolean.h \ + adouble.h vfs.h aep.h afp.h asp.h atp.h \ cnid.h compat.h ddp.h dsi.h ldapconfig.h list.h logger.h \ nbp.h netddp.h pap.h paths.h queue.h rtmp.h server_child.h \ server_ipc.h tdb.h uam.h unicode.h util.h uuid.h volinfo.h \ diff --git a/include/atalk/boolean.h b/include/atalk/boolean.h deleted file mode 100644 index 25120521..00000000 --- a/include/atalk/boolean.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _ATALK_BOOLEAN_H -#define _ATALK_BOOLEAN_H 1 - -/* - * bool is a standard type in c++. In theory its one bit in size. - * In reality just use the quickest standard type. - */ - -# ifndef __cplusplus -# ifndef bool -typedef char bool; - -/* - * bool, true and false - * - */ - -# endif /* ndef bool */ -# endif /* not C++ */ -# ifndef true -# define true ((bool) 1) -# endif -# ifndef false -# define false ((bool) 0) -# endif -typedef bool *BoolPtr; - -# ifndef TRUE -# define TRUE 1 -# endif /* TRUE */ - -# ifndef FALSE -# define FALSE 0 -# endif /* FALSE */ - -#endif diff --git a/include/atalk/logger.h b/include/atalk/logger.h index e91592bf..0c6e7d85 100644 --- a/include/atalk/logger.h +++ b/include/atalk/logger.h @@ -57,8 +57,7 @@ #include #include - -#include +#include #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/libatalk/util/logger.c b/libatalk/util/logger.c index 9ce83c4d..241b22df 100644 --- a/libatalk/util/logger.c +++ b/libatalk/util/logger.c @@ -27,10 +27,9 @@ Netatalk 2001 (c) #include #include #include +#include -#include #include - #include #define OPEN_LOGS_AS_UID 0 -- 2.39.2