]> arthur.barton.de Git - netatalk.git/commitdiff
Remove atalk/boolean.h, use stdbool.h instead
authorFrank Lahm <franklahm@googlemail.com>
Tue, 20 Sep 2011 12:51:02 +0000 (14:51 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Tue, 20 Sep 2011 12:51:02 +0000 (14:51 +0200)
bin/misc/logger_test.c
etc/afpd/fce_api.c
etc/afpd/fce_api_internal.h
etc/afpd/fce_util.c
include/atalk/Makefile.am
include/atalk/boolean.h [deleted file]
include/atalk/logger.h
libatalk/util/logger.c

index a968cce3ea802930b2b91e946f3af88eb191e348..b3ab7b53be6f2d70947c57d2691f34852bb6ffdf 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdio.h>
+#include <stdbool.h>
 
-#include <atalk/boolean.h>
 #include <atalk/logger.h>
 
 int main(int argc, char *argv[])
index fb7535b6c485e68b2dd8bfe269d2aabb8d89eca8..5c295c60e649ebb9b1367d7e0ed36e7ff43f5998 100644 (file)
@@ -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;
 }
index ff92fdc0187024cbed69307b81134c2466ab8340..9ed185e53457868b7107b42ee4322caebdcea198 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef _FCE_API_INTERNAL_H
 #define        _FCE_API_INTERNAL_H
 
+#include <stdbool.h>
+
 #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();
 
 
index ad6026f79a9e5aabdeb6746380009250d5d3eb94..8523aa48683d0eef0b7121da6953da3c41828eb7 100644 (file)
 #endif /* HAVE_CONFIG_H */
 
 #include <stdio.h>
-
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <time.h>
-
-
+#include <stdbool.h>
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -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;
 }
 
 /*
index e4939e29082a5954c7f5cac4eeac6da43f658d24..6058e6ec751666f14100bde093adc781b4530ef8 100644 (file)
@@ -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 (file)
index 2512052..0000000
+++ /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
index e91592bf68acd67bb30e20a1b02c240a298841c0..0c6e7d8536a85d2c3ee2ae219c44c2f8d909163e 100644 (file)
@@ -57,8 +57,7 @@
 
 #include <limits.h>
 #include <stdio.h>
-
-#include <atalk/boolean.h>
+#include <stdbool.h>
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
index 9ce83c4dc4fac3606dfa744ee6234f62b1b51165..241b22df092285aff506350c137d6c2122df9385 100644 (file)
@@ -27,10 +27,9 @@ Netatalk 2001 (c)
 #include <time.h>
 #include <ctype.h>
 #include <errno.h>
+#include <stdbool.h>
 
-#include <atalk/boolean.h>
 #include <atalk/util.h>
-
 #include <atalk/logger.h>
 
 #define OPEN_LOGS_AS_UID 0