From: Joel Rosdahl Date: Sat, 7 Nov 2009 08:09:39 +0000 (+0100) Subject: Remove trailing whitespace X-Git-Tag: v3.0pre0~168 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dca11d321b7259c47d39d94ea8cc7c994ea21bda;p=thirdparty%2Fccache.git Remove trailing whitespace --- diff --git a/Makefile.in b/Makefile.in index 4fafc65f8..0c365abce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -51,7 +51,7 @@ distclean: clean # FIXME: To fix this, test.sh needs to be able to take ccache from the # installed prefix, not from the source dir. -installcheck: +installcheck: @echo "WARNING! This is not really \"installcheck\" yet." $(MAKE) check diff --git a/README b/README index 6e68a6eb0..daab5e3a7 100644 --- a/README +++ b/README @@ -28,4 +28,3 @@ then read the ccache manual page Andrew Tridgell http://samba.org/~tridge/ bugs@ccache.samba.org - diff --git a/args.c b/args.c index 31e5471c1..f629640f0 100644 --- a/args.c +++ b/args.c @@ -2,17 +2,17 @@ convenient routines for argument list handling Copyright (C) Andrew Tridgell 2002 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -57,7 +57,7 @@ void args_pop(ARGS *args, int n) void args_remove_first(ARGS *args) { free(args->argv[0]); - memmove(&args->argv[0], + memmove(&args->argv[0], &args->argv[1], args->argc * sizeof(args->argv[0])); args->argc--; @@ -67,7 +67,7 @@ void args_remove_first(ARGS *args) void args_add_prefix(ARGS *args, const char *s) { args->argv = (char**)x_realloc(args->argv, (args->argc + 2) * sizeof(char *)); - memmove(&args->argv[1], &args->argv[0], + memmove(&args->argv[1], &args->argv[0], (args->argc+1) * sizeof(args->argv[0])); args->argv[0] = x_strdup(s); args->argc++; @@ -80,8 +80,8 @@ void args_strip(ARGS *args, const char *prefix) for (i=0; iargc; ) { if (strncmp(args->argv[i], prefix, strlen(prefix)) == 0) { free(args->argv[i]); - memmove(&args->argv[i], - &args->argv[i+1], + memmove(&args->argv[i], + &args->argv[i+1], args->argc * sizeof(args->argv[i])); args->argc--; } else { diff --git a/ccache.c b/ccache.c index 5967991fe..8cc242bed 100644 --- a/ccache.c +++ b/ccache.c @@ -5,17 +5,17 @@ Copyright (C) Andrew Tridgell 2002 Copyright (C) Martin Pool 2003 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -130,8 +130,8 @@ static void failed(void) } -/* return a string to be used to distinguish temporary files - this also tries to cope with NFS by adding the local hostname +/* return a string to be used to distinguish temporary files + this also tries to cope with NFS by adding the local hostname */ static const char *tmp_string(void) { @@ -175,7 +175,7 @@ static void to_cache(ARGS *args) * * unsetenv() is on BSD and Linux but not portable. */ putenv("DEPENDENCIES_OUTPUT"); - + if (getenv("CCACHE_CPP2")) { args_add(args, input_file); } else { @@ -225,7 +225,7 @@ static void to_cache(ARGS *args) exit(status); } } - + unlink(tmp_stderr); unlink(tmp_hashname); failed(); @@ -275,7 +275,7 @@ static void find_hash(ARGS *args) int nlevels = 2; char *input_base; char *tmp; - + if ((s = getenv("CCACHE_NLEVELS"))) { nlevels = atoi(s); if (nlevels < 1) nlevels = 1; @@ -361,7 +361,7 @@ static void find_hash(ARGS *args) } } - /* ~/hello.c -> tmp.hello.123.i + /* ~/hello.c -> tmp.hello.123.i limit the basename to 10 characters in order to cope with filesystem with small maximum filename length limits */ @@ -376,7 +376,7 @@ static void find_hash(ARGS *args) /* now the run */ x_asprintf(&path_stdout, "%s/%s.tmp.%s.%s", temp_dir, - input_base, tmp_string(), + input_base, tmp_string(), i_extension); x_asprintf(&path_stderr, "%s/tmp.cpp_stderr.%s", temp_dir, tmp_string()); @@ -412,7 +412,7 @@ static void find_hash(ARGS *args) /* if the compilation is with -g then we have to include the whole of the preprocessor output, which means we are sensitive to line number information. Otherwise we can discard line number info, which makes - us less sensitive to reformatting changes + us less sensitive to reformatting changes Note! I have now disabled the unification code by default as it gives the wrong line numbers for warnings. Pity. @@ -434,7 +434,7 @@ static void find_hash(ARGS *args) data and output it just before the main stderr from the compiler pass */ cpp_stderr = path_stderr; - } else { + } else { unlink(path_stderr); free(path_stderr); } @@ -464,7 +464,7 @@ static void find_hash(ARGS *args) } -/* +/* try to return the compile result from cache. If we can return from cache then this function exits with the correct status code, otherwise it returns */ @@ -541,7 +541,7 @@ static void from_cache(int first) if (ret == -1) { ret = copy_file(hashname, output_file); if (ret == -1) { - cc_log("failed to copy %s -> %s (%s)\n", + cc_log("failed to copy %s -> %s (%s)\n", hashname, output_file, strerror(errno)); stats_update(STATS_ERROR); failed(); @@ -580,7 +580,7 @@ static void from_cache(int first) exit(0); } -/* find the real compiler. We just search the PATH to find a executable of the +/* find the real compiler. We just search the PATH to find a executable of the same name that isn't a link to ourselves */ static void find_compiler(int argc, char **argv) { @@ -646,8 +646,8 @@ static const char *check_extension(const char *fname, int *direct_i) } -/* - process the compiler options to form the correct set of options +/* + process the compiler options to form the correct set of options for obtaining the preprocessor output */ static void process_args(int argc, char **argv) @@ -701,7 +701,7 @@ static void process_args(int argc, char **argv) found_S_opt = 1; continue; } - + /* we need to work out where the output was meant to go */ if (strcmp(argv[i], "-o") == 0) { if (i == argc-1) { @@ -713,7 +713,7 @@ static void process_args(int argc, char **argv) i++; continue; } - + /* alternate form of -o, with no space */ if (strncmp(argv[i], "-o", 2) == 0) { output_file = &argv[i][2]; @@ -721,7 +721,7 @@ static void process_args(int argc, char **argv) } /* debugging is handled specially, so that we know if we - can strip line number info + can strip line number info */ if (strncmp(argv[i], "-g", 2) == 0) { args_add(stripped_args, argv[i]); @@ -757,21 +757,21 @@ static void process_args(int argc, char **argv) { const char *opts[] = {"-I", "-include", "-imacros", "-iprefix", "-iwithprefix", "-iwithprefixbefore", - "-L", "-D", "-U", "-x", "-MF", + "-L", "-D", "-U", "-x", "-MF", "-MT", "-MQ", "-isystem", "-aux-info", "--param", "-A", "-Xlinker", "-u", - "-idirafter", + "-idirafter", NULL}; int j; for (j=0;opts[j];j++) { if (strcmp(argv[i], opts[j]) == 0) { if (i == argc-1) { - cc_log("missing argument to %s\n", + cc_log("missing argument to %s\n", argv[i]); stats_update(STATS_ARGS); failed(); } - + args_add(stripped_args, argv[i]); args_add(stripped_args, argv[i+1]); i++; @@ -792,7 +792,7 @@ static void process_args(int argc, char **argv) cope better with unusual compiler options */ if (stat(argv[i], &st) != 0 || !S_ISREG(st.st_mode)) { args_add(stripped_args, argv[i]); - continue; + continue; } if (input_file) { @@ -882,7 +882,7 @@ static void process_args(int argc, char **argv) } else { int len = p - default_depfile_name; - + p = x_malloc(len + 3); strncpy(default_depfile_name, p, len - 1); free(default_depfile_name); @@ -922,7 +922,7 @@ static void ccache(int argc, char *argv[]) cc_log("ccache is disabled\n"); failed(); } - + /* we might be disabled */ if (getenv("CCACHE_DISABLE")) { cc_log("ccache is disabled\n"); @@ -946,7 +946,7 @@ static void ccache(int argc, char *argv[]) cc_log("read-only set - doing real compile\n"); failed(); } - + prefix = getenv("CCACHE_PREFIX"); if (prefix) { char *p = find_executable(prefix, MYNAME); @@ -974,7 +974,7 @@ static void usage(void) { printf("ccache, a compiler cache. Version %s\n", CCACHE_VERSION); printf("Copyright Andrew Tridgell, 2002\n\n"); - + printf("Usage:\n"); printf("\tccache [options]\n"); printf("\tccache compiler [compile options]\n"); @@ -1028,7 +1028,7 @@ static int ccache_main(int argc, char *argv[]) case 'h': usage(); exit(0); - + case 's': check_cache_dir(); stats_summary(); @@ -1090,7 +1090,7 @@ static void setup_uncached_err(void) { char *buf; int uncached_fd; - + uncached_fd = dup(2); if (uncached_fd == -1) { cc_log("dup(2) failed\n"); @@ -1127,7 +1127,7 @@ int main(int argc, char *argv[]) cache_logfile = getenv("CCACHE_LOGFILE"); setup_uncached_err(); - + /* the user might have set CCACHE_UMASK */ p = getenv("CCACHE_UMASK"); @@ -1157,7 +1157,7 @@ int main(int argc, char *argv[]) /* make sure the cache dir exists */ if (cache_dir && (create_dir(cache_dir) != 0)) { - fprintf(stderr,"ccache: failed to create %s (%s)\n", + fprintf(stderr,"ccache: failed to create %s (%s)\n", cache_dir, strerror(errno)); exit(1); } diff --git a/ccache.h b/ccache.h index 8d7e7016b..448dae694 100644 --- a/ccache.h +++ b/ccache.h @@ -146,7 +146,7 @@ void cleanup_dir(const char *dir, size_t maxfiles, size_t maxsize); void cleanup_all(const char *dir); void wipe_all(const char *dir); -int execute(char **argv, +int execute(char **argv, const char *path_stdout, const char *path_stderr); char *find_executable(const char *name, const char *exclude_name); diff --git a/ccache.yo b/ccache.yo index d4f1a8053..30115d3a0 100644 --- a/ccache.yo +++ b/ccache.yo @@ -11,7 +11,7 @@ ccache [COMPILER OPTIONS] manpagedescription() -ccache is a compiler cache. It speeds up re-compilation of C/C++ code +ccache is a compiler cache. It speeds up re-compilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again. @@ -45,7 +45,7 @@ cache. The statistics are stored spread across the subdirectories of the cache. Using "ccache -s" adds up the statistics across all subdirectories and prints the totals. -dit(bf(-z, --zero-stats)) Zero the cache statistics. +dit(bf(-z, --zero-stats)) Zero the cache statistics. dit(bf(-V, --version)) Print the ccache version number @@ -83,7 +83,7 @@ some specific projects. The second method is most useful for when you wish to use ccache for all your compiles. To install for usage by the first method just copy ccache to somewhere -in your path. +in your path. To install for the second method do something like this: verb( @@ -105,7 +105,7 @@ When run as a compiler front end ccache usually just takes the same command line options as the compiler you are using. The only exception to this is the option '--ccache-skip'. That option can be used to tell ccache that the next option is definitely not a input filename, and -should be passed along to the compiler as-is. +should be passed along to the compiler as-is. The reason this can be important is that ccache does need to parse the command line and determine what is an input filename and what is a @@ -183,7 +183,7 @@ each compile. dit(bf(CCACHE_NLEVELS)) The environment variable CCACHE_NLEVELS allows you to choose the number of levels of hash in the cache directory. The -default is 2. The minimum is 1 and the maximum is 8. +default is 2. The minimum is 1 and the maximum is 8. dit(bf(CCACHE_HARDLINK)) If you set the environment variable CCACHE_HARDLINK then ccache will attempt to use hard links from the @@ -300,7 +300,7 @@ ccache avoids the compile completely where possible. To use distcc with ccache I recommend using the CCACHE_PREFIX option. You just need to set the environment variable CCACHE_PREFIX to 'distcc' and ccache will prefix the command line used with the -compiler with the command 'distcc'. +compiler with the command 'distcc'. manpagesection(SHARING A CACHE) @@ -320,7 +320,7 @@ itemize( to 002, this ensures that cached files are accessible to everyone in the group. it() Make sure that all users have write permission in the entire - cache directory (and that you trust all users of the shared cache). + cache directory (and that you trust all users of the shared cache). it() Make sure that the setgid bit is set on all directories in the cache. This tells the filesystem to inherit group ownership for new directories. The command "chmod g+s `find $CCACHE_DIR -type d`" might @@ -333,7 +333,7 @@ manpagesection(HISTORY) ccache was inspired by the compilercache shell script script written by Erik Thiele and I would like to thank him for an excellent piece of -work. See +work. See url(http://www.erikyyy.de/compilercache/)(http://www.erikyyy.de/compilercache/) for the Erik's scripts. diff --git a/cleanup.c b/cleanup.c index 33aa38613..8bfa7ac20 100644 --- a/cleanup.c +++ b/cleanup.c @@ -1,22 +1,22 @@ /* Copyright (C) Andrew Tridgell 2002 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* - functions to cleanup the cache directory when it gets too large + functions to cleanup the cache directory when it gets too large */ #include "ccache.h" @@ -72,7 +72,7 @@ static void traverse_fn(const char *fname, struct stat *st) if (num_files == allocated) { allocated = 10000 + num_files*2; - files = (struct files **)x_realloc(files, + files = (struct files **)x_realloc(files, sizeof(struct files *)*allocated); } @@ -92,23 +92,23 @@ static void sort_and_clean(void) if (num_files > 1) { /* sort in ascending data order */ - qsort(files, num_files, sizeof(struct files *), + qsort(files, num_files, sizeof(struct files *), (COMPAR_FN_T)files_compare); } - + /* delete enough files to bring us below the threshold */ for (i=0;ifname) != 0 && errno != ENOENT) { - fprintf(stderr, "unlink %s - %s\n", + fprintf(stderr, "unlink %s - %s\n", files[i]->fname, strerror(errno)); continue; } - + total_size -= files[i]->size; - } + } total_files = num_files - i; } @@ -152,7 +152,7 @@ void cleanup_all(const char *dir) unsigned counters[STATS_END]; char *dname, *sfile; int i; - + for (i=0;i<=0xF;i++) { x_asprintf(&dname, "%s/%1x", dir, i); x_asprintf(&sfile, "%s/%1x/stats", dir, i); @@ -160,8 +160,8 @@ void cleanup_all(const char *dir) memset(counters, 0, sizeof(counters)); stats_read(sfile, counters); - cleanup_dir(dname, - counters[STATS_MAXFILES], + cleanup_dir(dname, + counters[STATS_MAXFILES], counters[STATS_MAXSIZE]); free(dname); free(sfile); @@ -192,7 +192,7 @@ void wipe_all(const char *dir) { char *dname; int i; - + for (i=0;i<=0xF;i++) { x_asprintf(&dname, "%s/%1x", dir, i); traverse(dir, wipe_fn); diff --git a/configure.ac b/configure.ac index b9410b26d..72391f5ca 100644 --- a/configure.ac +++ b/configure.ac @@ -56,7 +56,7 @@ AC_CACHE_CHECK([for C99 vsnprintf],ccache_cv_HAVE_C99_VSNPRINTF,[ AC_TRY_RUN([ #include #include -void foo(const char *format, ...) { +void foo(const char *format, ...) { va_list ap; int len; char buf[5]; diff --git a/execute.c b/execute.c index 4b98ab735..37252d623 100644 --- a/execute.c +++ b/execute.c @@ -1,16 +1,16 @@ /* Copyright (C) Andrew Tridgell 2002 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -23,7 +23,7 @@ execute a compiler backend, capturing all output to the given paths the full path to the compiler to run is in argv[0] */ -int execute(char **argv, +int execute(char **argv, const char *path_stdout, const char *path_stderr) { @@ -32,7 +32,7 @@ int execute(char **argv, pid = fork(); if (pid == -1) fatal("Failed to fork"); - + if (pid == 0) { int fd; @@ -68,7 +68,7 @@ int execute(char **argv, /* - find an executable by name in $PATH. Exclude any that are links to exclude_name + find an executable by name in $PATH. Exclude any that are links to exclude_name */ char *find_executable(const char *name, const char *exclude_name) { @@ -90,7 +90,7 @@ char *find_executable(const char *name, const char *exclude_name) } path = x_strdup(path); - + /* search the path looking for the first compiler of the right name that isn't us */ for (tok=strtok(path,":"); tok; tok = strtok(NULL, ":")) { diff --git a/hash.c b/hash.c index d0ce8a6ba..7c8931738 100644 --- a/hash.c +++ b/hash.c @@ -1,16 +1,16 @@ /* Copyright (C) Andrew Tridgell 2002 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -70,7 +70,7 @@ char *hash_result(void) hash_buffer(NULL, 0); mdfour_result(&md, sum); - + for (i=0;i<16;i++) { sprintf(&ret[i*2], "%02x", (unsigned)sum[i]); } diff --git a/install-sh b/install-sh index 58719246f..ba5e22ad4 100755 --- a/install-sh +++ b/install-sh @@ -103,7 +103,7 @@ fi if [ x"$dir_arg" != x ]; then dst=$src src="" - + if [ -d $dst ]; then instcmd=: else @@ -112,7 +112,7 @@ if [ x"$dir_arg" != x ]; then else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad +# might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] @@ -122,7 +122,7 @@ else echo "install: $src does not exist" exit 1 fi - + if [ x"$dst" = x ] then echo "install: no destination specified" @@ -150,7 +150,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then -defaultIFS=' +defaultIFS=' ' IFS="${IFS-${defaultIFS}}" @@ -189,17 +189,17 @@ else # If we're going to rename the final executable, determine the name now. - if [ x"$transformarg" = x ] + if [ x"$transformarg" = x ] then dstfile=`basename $dst` else - dstfile=`basename $dst $transformbasename | + dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename - if [ x"$dstfile" = x ] + if [ x"$dstfile" = x ] then dstfile=`basename $dst` else @@ -230,7 +230,7 @@ else # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + $doit $mvcmd $dsttmp $dstdir/$dstfile fi && diff --git a/manage-cache.sh b/manage-cache.sh index 7ef329dfa..cb22ade79 100644 --- a/manage-cache.sh +++ b/manage-cache.sh @@ -65,4 +65,3 @@ echo # clean up rm $tmpfile - diff --git a/mdfour.c b/mdfour.c index ca7af79e2..b54c5f66b 100644 --- a/mdfour.c +++ b/mdfour.c @@ -1,17 +1,17 @@ -/* +/* a implementation of MD4 designed for use in the SMB authentication protocol Copyright (C) Andrew Tridgell 1997-1998. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -19,7 +19,7 @@ #include "ccache.h" -/* NOTE: This code makes no attempt to be fast! +/* NOTE: This code makes no attempt to be fast! It assumes that a int is at least 32 bits long */ @@ -43,41 +43,41 @@ static void mdfour64(uint32 *M) uint32 AA, BB, CC, DD; uint32 A,B,C,D; - A = m->A; B = m->B; C = m->C; D = m->D; + A = m->A; B = m->B; C = m->C; D = m->D; AA = A; BB = B; CC = C; DD = D; - ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7); + ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7); ROUND1(C,D,A,B, 2, 11); ROUND1(B,C,D,A, 3, 19); - ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7); + ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7); ROUND1(C,D,A,B, 6, 11); ROUND1(B,C,D,A, 7, 19); - ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7); + ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7); ROUND1(C,D,A,B, 10, 11); ROUND1(B,C,D,A, 11, 19); - ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7); - ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19); + ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7); + ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19); - ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5); + ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5); ROUND2(C,D,A,B, 8, 9); ROUND2(B,C,D,A, 12, 13); - ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5); + ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5); ROUND2(C,D,A,B, 9, 9); ROUND2(B,C,D,A, 13, 13); - ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5); + ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5); ROUND2(C,D,A,B, 10, 9); ROUND2(B,C,D,A, 14, 13); - ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5); + ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5); ROUND2(C,D,A,B, 11, 9); ROUND2(B,C,D,A, 15, 13); - ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9); + ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9); ROUND3(C,D,A,B, 4, 11); ROUND3(B,C,D,A, 12, 15); - ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9); + ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9); ROUND3(C,D,A,B, 6, 11); ROUND3(B,C,D,A, 14, 15); - ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9); + ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9); ROUND3(C,D,A,B, 5, 11); ROUND3(B,C,D,A, 13, 15); - ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9); + ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9); ROUND3(C,D,A,B, 7, 11); ROUND3(B,C,D,A, 15, 15); - A += AA; B += BB; + A += AA; B += BB; C += CC; D += DD; - - A &= MASK32; B &= MASK32; + + A &= MASK32; B &= MASK32; C &= MASK32; D &= MASK32; m->A = A; m->B = B; m->C = C; m->D = D; @@ -130,7 +130,7 @@ static void mdfour_tail(const unsigned char *in, int n) copy64(M, buf); mdfour64(M); } else { - copy4(buf+120, b); + copy4(buf+120, b); copy64(M, buf); mdfour64(M); copy64(M, buf+64); @@ -206,7 +206,7 @@ static void file_checksum1(char *fname) struct mdfour md; unsigned char buf[1024], sum[16]; unsigned chunk; - + fd = open(fname,O_RDONLY|O_BINARY); if (fd == -1) { perror("fname"); @@ -214,7 +214,7 @@ static void file_checksum1(char *fname) } chunk = 1 + random() % (sizeof(buf) - 1); - + mdfour_begin(&md); while (1) { @@ -250,7 +250,7 @@ static void file_checksum2(char *fname) perror("fname"); exit(1); } - + MDbegin(&md); while (1) { diff --git a/mdfour.h b/mdfour.h index 92ef2f831..17dc82605 100644 --- a/mdfour.h +++ b/mdfour.h @@ -1,19 +1,19 @@ -/* +/* Unix SMB/Netbios implementation. Version 1.9. a implementation of MD4 designed for use in the SMB authentication protocol Copyright (C) Andrew Tridgell 1997-1998. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -23,14 +23,10 @@ struct mdfour { uint32 A, B, C, D; uint32 totalN; unsigned char tail[64]; - unsigned tail_len; + unsigned tail_len; }; void mdfour_begin(struct mdfour *md); void mdfour_update(struct mdfour *md, const unsigned char *in, int n); void mdfour_result(struct mdfour *md, unsigned char *out); void mdfour(unsigned char *out, const unsigned char *in, int n); - - - - diff --git a/snprintf.c b/snprintf.c index 32187c1a5..4a3340466 100644 --- a/snprintf.c +++ b/snprintf.c @@ -35,9 +35,9 @@ * original. Also, there is now a builtin-test, just compile with: * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm * and run snprintf for results. - * + * * Thomas Roessler 01/27/98 for mutt 0.89i - * The PGP code was using unsigned hexadecimal formats. + * The PGP code was using unsigned hexadecimal formats. * Unfortunately, unsigned formats simply didn't work. * * Michael Elkins 03/05/98 for mutt 0.90.8 @@ -79,7 +79,7 @@ /* only include stdio.h if we are not re-defining snprintf or vsnprintf */ #include /* make the compiler happy with an empty file */ - void dummy_snprintf(void) {} + void dummy_snprintf(void) {} #else #ifdef HAVE_LONG_DOUBLE @@ -94,7 +94,7 @@ #define LLONG long #endif -static size_t dopr(char *buffer, size_t maxlen, const char *format, +static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args); static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, int min, int max); @@ -150,21 +150,21 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args int flags; int cflags; size_t currlen; - + state = DP_S_DEFAULT; currlen = flags = cflags = min = 0; max = -1; ch = *format++; - + while (state != DP_S_DONE) { - if (ch == '\0') + if (ch == '\0') state = DP_S_DONE; switch(state) { case DP_S_DEFAULT: - if (ch == '%') + if (ch == '%') state = DP_S_FLAGS; - else + else dopr_outch (buffer, &currlen, maxlen, ch); ch = *format++; break; @@ -211,7 +211,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args if (ch == '.') { state = DP_S_MAX; ch = *format++; - } else { + } else { state = DP_S_MOD; } break; @@ -256,7 +256,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args switch (ch) { case 'd': case 'i': - if (cflags == DP_C_SHORT) + if (cflags == DP_C_SHORT) value = va_arg (args, int); else if (cflags == DP_C_LONG) value = va_arg (args, long int); @@ -387,12 +387,12 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args } } if (maxlen != 0) { - if (currlen < maxlen - 1) + if (currlen < maxlen - 1) buffer[currlen] = '\0'; - else if (maxlen > 0) + else if (maxlen > 0) buffer[maxlen - 1] = '\0'; } - + return currlen; } @@ -411,11 +411,11 @@ static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, for (strln = 0; value[strln]; ++strln); /* strlen */ padlen = min - strln; - if (padlen < 0) + if (padlen < 0) padlen = 0; - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justify */ - + while ((padlen > 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); --padlen; @@ -444,12 +444,12 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, int spadlen = 0; /* amount to space pad */ int zpadlen = 0; /* amount to zero pad */ int caps = 0; - + if (max < 0) max = 0; - + uvalue = value; - + if(!(flags & DP_F_UNSIGNED)) { if( value < 0 ) { signvalue = '-'; @@ -461,7 +461,7 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, signvalue = ' '; } } - + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ do { @@ -481,7 +481,7 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, zpadlen = MAX(zpadlen, spadlen); spadlen = 0; } - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) spadlen = -spadlen; /* Left Justifty */ #ifdef DEBUG_SNPRINTF @@ -496,7 +496,7 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, } /* Sign */ - if (signvalue) + if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); /* Zeros */ @@ -508,9 +508,9 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, } /* Digits */ - while (place > 0) + while (place > 0) dopr_outch (buffer, currlen, maxlen, convert[--place]); - + /* Left Justified spaces */ while (spadlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); @@ -524,19 +524,19 @@ static LDOUBLE abs_val(LDOUBLE value) if (value < 0) result = -value; - + return result; } static LDOUBLE POW10(int exp) { LDOUBLE result = 1; - + while (exp) { result *= 10; exp--; } - + return result; } @@ -547,7 +547,7 @@ static LLONG ROUND(LDOUBLE value) intpart = (LLONG)value; value = value - intpart; if (value >= 0.5) intpart++; - + return intpart; } @@ -580,7 +580,7 @@ static double my_modf(double x0, double *iptr) ret = my_modf(x0-l*f, &i2); (*iptr) = l*f + i2; return ret; - } + } (*iptr) = l; return x - (*iptr); @@ -597,14 +597,14 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, int iplace = 0; int fplace = 0; int padlen = 0; /* amount to pad */ - int zpadlen = 0; + int zpadlen = 0; int caps = 0; int index; double intpart; double fracpart; double temp; - - /* + + /* * AIX manpage says the default is 0, but Solaris says the default * is 6, and sprintf on AIX defaults to 6 */ @@ -632,8 +632,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */ #endif - /* - * Sorry, we only support 16 digits past the decimal because of our + /* + * Sorry, we only support 16 digits past the decimal because of our * conversion method */ if (max > 16) @@ -647,7 +647,7 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, my_modf(temp, &intpart); fracpart = ROUND((POW10(max)) * (ufvalue - intpart)); - + if (fracpart >= POW10(max)) { intpart++; fracpart -= POW10(max); @@ -684,16 +684,16 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, if (fplace == 311) fplace--; } fconvert[fplace] = 0; - + /* -1 for decimal point, another -1 if we are printing a sign */ - padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); + padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; - if (padlen < 0) + if (padlen < 0) padlen = 0; - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justifty */ - + if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { dopr_outch (buffer, currlen, maxlen, signvalue); @@ -709,10 +709,10 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, dopr_outch (buffer, currlen, maxlen, ' '); --padlen; } - if (signvalue) + if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); - - while (iplace > 0) + + while (iplace > 0) dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); #ifdef DEBUG_SNPRINTF @@ -725,11 +725,11 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, */ if (max > 0) { dopr_outch (buffer, currlen, maxlen, '.'); - - while (fplace > 0) + + while (fplace > 0) dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); } - + while (zpadlen > 0) { dopr_outch (buffer, currlen, maxlen, '0'); --zpadlen; @@ -770,7 +770,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) { size_t ret; va_list ap; - + va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap); @@ -778,13 +778,13 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) } #endif -#endif +#endif #ifndef HAVE_VASPRINTF int vasprintf(char **ptr, const char *format, va_list ap) { int ret; - + ret = vsnprintf(0, 0, format, ap); if (ret <= 0) return ret; @@ -802,7 +802,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) { va_list ap; int ret; - + *ptr = 0; va_start(ap, format); ret = vasprintf(ptr, format, ap); @@ -852,7 +852,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) "-16.16f", 0 }; - double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, + double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, 0.9996, 1.996, 4.136, 0}; char *int_fmt[] = { "%-1.5d", @@ -894,7 +894,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) int l2 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]); sprintf (buf2, fp_fmt[x], fp_nums[y]); if (strcmp (buf1, buf2)) { - printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", + printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", fp_fmt[x], buf1, buf2); fail++; } @@ -912,7 +912,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) int l2 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]); sprintf (buf2, int_fmt[x], int_nums[y]); if (strcmp (buf1, buf2)) { - printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", + printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", int_fmt[x], buf1, buf2); fail++; } @@ -930,7 +930,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) int l2 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]); sprintf (buf2, str_fmt[x], str_vals[y]); if (strcmp (buf1, buf2)) { - printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", + printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", str_fmt[x], buf1, buf2); fail++; } diff --git a/stats.c b/stats.c index 593cd1532..d2ed9cc2e 100644 --- a/stats.c +++ b/stats.c @@ -1,16 +1,16 @@ /* Copyright (C) Andrew Tridgell 2002 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -236,7 +236,7 @@ void stats_summary(void) for (i=0;stats_info[i].message;i++) { enum stats stat = stats_info[i].stat; - if (counters[stat] == 0 && + if (counters[stat] == 0 && !(stats_info[i].flags & FLAG_ALWAYS)) { continue; } diff --git a/test.sh b/test.sh index c59bc49be..f4d10eb81 100755 --- a/test.sh +++ b/test.sh @@ -71,22 +71,22 @@ basetests() { $CCACHE_COMPILE -c test1.c checkstat 'cache hit' 0 checkstat 'cache miss' 1 - + testname="BASIC2" $CCACHE_COMPILE -c test1.c checkstat 'cache hit' 1 checkstat 'cache miss' 1 - + testname="debug" $CCACHE_COMPILE -c test1.c -g checkstat 'cache hit' 1 checkstat 'cache miss' 2 - + testname="debug2" $CCACHE_COMPILE -c test1.c -g checkstat 'cache hit' 2 checkstat 'cache miss' 2 - + testname="output" $CCACHE_COMPILE -c test1.c -o foo.o checkstat 'cache hit' 3 @@ -102,7 +102,7 @@ basetests() { testname="find" $CCACHE blahblah -c test1.c 2> /dev/null - checkstat "couldn't find the compiler" 1 + checkstat "couldn't find the compiler" 1 testname="bad" $CCACHE_COMPILE -c test1.c -I 2> /dev/null @@ -134,31 +134,31 @@ basetests() { testname="CCACHE_DISABLE" CCACHE_DISABLE=1 $CCACHE_COMPILE -c test1.c 2> /dev/null - checkstat 'cache hit' 3 + checkstat 'cache hit' 3 $CCACHE_COMPILE -c test1.c - checkstat 'cache hit' 4 + checkstat 'cache hit' 4 testname="CCACHE_CPP2" CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c -O -O - checkstat 'cache hit' 4 + checkstat 'cache hit' 4 checkstat 'cache miss' 3 CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c -O -O - checkstat 'cache hit' 5 + checkstat 'cache hit' 5 checkstat 'cache miss' 3 testname="CCACHE_NOSTATS" CCACHE_NOSTATS=1 $CCACHE_COMPILE -c test1.c -O -O checkstat 'cache hit' 5 checkstat 'cache miss' 3 - + testname="CCACHE_RECACHE" CCACHE_RECACHE=1 $CCACHE_COMPILE -c test1.c -O -O - checkstat 'cache hit' 5 + checkstat 'cache hit' 5 checkstat 'cache miss' 4 # strictly speaking should be 6 - RECACHE causes a double counting! - checkstat 'files in cache' 8 + checkstat 'files in cache' 8 $CCACHE -c > /dev/null checkstat 'files in cache' 6 @@ -173,7 +173,7 @@ basetests() { checkstat 'cache miss' 5 checkstat 'files in cache' 8 - + testname="comments" echo '/* a silly comment */' > test1-comment.c cat test1.c >> test1-comment.c @@ -225,7 +225,7 @@ basetests() { checkstat 'cache miss' 38 # removed these tests as some compilers (including newer versions of gcc) - # determine which language to use based on .ii/.i extension, and C++ may + # determine which language to use based on .ii/.i extension, and C++ may # not be installed # testname="direct .ii file" # mv test1.i test1.ii @@ -236,7 +236,7 @@ basetests() { # $CCACHE_COMPILE -c test1.ii # checkstat 'cache hit' 11 # checkstat 'cache miss' 39 - + testname="zero-stats" $CCACHE -z > /dev/null checkstat 'cache hit' 0 diff --git a/unify.c b/unify.c index e436ed7fd..1395b9d0e 100644 --- a/unify.c +++ b/unify.c @@ -1,16 +1,16 @@ /* Copyright (C) Andrew Tridgell 2002 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -27,7 +27,7 @@ this unifier is much faster (about 2x) and more forgiving of syntactic errors. Continuing on syntactic errors is important to cope with C/C++ extensions in the local compiler (for example, - inline assembly systems). + inline assembly systems). */ #include "ccache.h" @@ -146,7 +146,7 @@ static void unify(unsigned char *p, size_t size) do { pushchar(p[ofs]); ofs++; - } while (ofs < size && + } while (ofs < size && (tokens[p[ofs]].type & (C_ALPHA|C_DIGIT))); pushchar('\n'); continue; @@ -156,7 +156,7 @@ static void unify(unsigned char *p, size_t size) do { pushchar(p[ofs]); ofs++; - } while (ofs < size && + } while (ofs < size && ((tokens[p[ofs]].type & C_DIGIT) || p[ofs] == '.')); if (ofs < size && (p[ofs] == 'x' || p[ofs] == 'X')) { do { @@ -167,7 +167,7 @@ static void unify(unsigned char *p, size_t size) if (ofs < size && (p[ofs] == 'E' || p[ofs] == 'e')) { pushchar(p[ofs]); ofs++; - while (ofs < size && + while (ofs < size && (tokens[p[ofs]].type & (C_DIGIT|C_SIGN))) { pushchar(p[ofs]); ofs++; @@ -187,7 +187,7 @@ static void unify(unsigned char *p, size_t size) } while (ofs < size && (tokens[p[ofs]].type & C_SPACE)); continue; } - + if (tokens[p[ofs]].type & C_QUOTE) { q = p[ofs]; pushchar(p[ofs]); @@ -233,13 +233,13 @@ static void unify(unsigned char *p, size_t size) } -/* hash a file that consists of preprocessor output, but remove any line +/* hash a file that consists of preprocessor output, but remove any line number information from the hash */ int unify_hash(const char *fname) { int fd; - struct stat st; + struct stat st; char *map; fd = open(fname, O_RDONLY|O_BINARY); @@ -266,4 +266,3 @@ int unify_hash(const char *fname) return 0; } - diff --git a/util.c b/util.c index 5f8af5939..f8d619a24 100644 --- a/util.c +++ b/util.c @@ -1,16 +1,16 @@ /* Copyright (C) Andrew Tridgell 2002 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -30,7 +30,7 @@ void cc_log(const char *format, ...) if (!logfile) logfile = fopen(cache_logfile, "a"); if (!logfile) return; - + va_start(ap, format); vfprintf(logfile, format, ap); va_end(ap); @@ -72,13 +72,13 @@ static int safe_rename(const char* oldpath, const char* newpath) return -1; } } - + /* move a file using rename */ int move_file(const char *src, const char *dest) { return safe_rename(src, dest); } -/* copy a file - used when hard links don't work +/* copy a file - used when hard links don't work the copy is done via a temporary file and atomic rename */ int copy_file(const char *src, const char *dest) @@ -305,7 +305,7 @@ int test_if_compressed(const char *filename) { fclose(f); return 0; } - + fclose(f); return 1; } @@ -374,7 +374,7 @@ void x_asprintf(char **ptr, const char *format, ...) fatal("out of memory in x_asprintf"); } va_end(ap); - + if (!*ptr) fatal("out of memory in x_asprintf"); } @@ -419,7 +419,7 @@ void *x_realloc(void *ptr, size_t size) } -/* +/* revsusive directory traversal - used for cleanup fn() is called on all files/dirs in the tree */ @@ -467,7 +467,7 @@ char *str_basename(const char *s) char *p = strrchr(s, '/'); if (p) { return x_strdup(p+1); - } + } return x_strdup(s); } @@ -480,7 +480,7 @@ char *dirname(char *s) p = strrchr(s, '/'); if (p) { *p = 0; - } + } return s; } @@ -568,7 +568,7 @@ size_t value_units(const char *s) /* - a sane realpath() function, trying to cope with stupid path limits and + a sane realpath() function, trying to cope with stupid path limits and a broken API */ char *x_realpath(const char *path) @@ -583,7 +583,7 @@ char *x_realpath(const char *path) maxlen = pathconf(path, _PC_PATH_MAX); #endif if (maxlen < 4096) maxlen = 4096; - + ret = x_malloc(maxlen); #if HAVE_REALPATH