Mercurial > hg > cdb
changeset 10:3bfef1f22a97
trivial changes to get rid of compile-time warnings
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Fri, 31 Jan 2025 15:26:11 +0000 |
| parents | 79b6f035cd96 |
| children | 978eaa166609 |
| files | Makefile alloc.c auto-str.c buffer.c buffer.h buffer_0.c buffer_get.c buffer_put.c cdbdump.c cdbget.c cdbmake.c cdbstats.c cdbtest.c conf-cc.ac conf-ld.ac install.c instcheck.c readwrite.h seek.h testzero.c trycpp.c x86cpuid.c |
| diffstat | 22 files changed, 28 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Fri Jan 31 13:37:33 2025 +0000 +++ b/Makefile Fri Jan 31 15:26:11 2025 +0000 @@ -266,7 +266,7 @@ prog: \ cdbget cdbmake cdbdump cdbstats cdbtest cdbmake-12 cdbmake-sv rts \ -testzero +testzero libcdb.a # run tests rts: \
--- a/alloc.c Fri Jan 31 13:37:33 2025 +0000 +++ b/alloc.c Fri Jan 31 15:26:11 2025 +0000 @@ -1,7 +1,6 @@ #include "alloc.h" #include "error.h" -extern char *malloc(); -extern void free(); +#include <stdlib.h> #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */ #define SPACE 4096 /* must be multiple of ALIGNMENT */
--- a/auto-str.c Fri Jan 31 13:37:33 2025 +0000 +++ b/auto-str.c Fri Jan 31 15:26:11 2025 +0000 @@ -11,7 +11,7 @@ if (buffer_puts(&ss1,s) == -1) _exit(111); } -main(argc,argv) +int main(argc,argv) int argc; char **argv; {
--- a/buffer.c Fri Jan 31 13:37:33 2025 +0000 +++ b/buffer.c Fri Jan 31 15:26:11 2025 +0000 @@ -1,6 +1,6 @@ #include "buffer.h" -void buffer_init(buffer *s,int (*op)(),int fd,char *buf,unsigned int len) +void buffer_init(buffer *s,ssize_t (*op)(),int fd,char *buf,unsigned int len) { s->x = buf; s->fd = fd;
--- a/buffer.h Fri Jan 31 13:37:33 2025 +0000 +++ b/buffer.h Fri Jan 31 15:26:11 2025 +0000 @@ -1,19 +1,21 @@ #ifndef BUFFER_H #define BUFFER_H +#include <unistd.h> + typedef struct buffer { char *x; unsigned int p; unsigned int n; int fd; - int (*op)(); + ssize_t (*op)(); } buffer; #define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } #define BUFFER_INSIZE 8192 #define BUFFER_OUTSIZE 8192 -extern void buffer_init(buffer *,int (*)(),int,char *,unsigned int); +extern void buffer_init(buffer *,ssize_t (*)(),int,char *,unsigned int); extern int buffer_flush(buffer *); extern int buffer_put(buffer *,char *,unsigned int);
--- a/buffer_0.c Fri Jan 31 13:37:33 2025 +0000 +++ b/buffer_0.c Fri Jan 31 15:26:11 2025 +0000 @@ -1,7 +1,7 @@ #include "readwrite.h" #include "buffer.h" -int buffer_0_read(fd,buf,len) int fd; char *buf; int len; +ssize_t buffer_0_read(fd,buf,len) int fd; char *buf; int len; { if (buffer_flush(buffer_1) == -1) return -1; return read(fd,buf,len);
--- a/buffer_get.c Fri Jan 31 13:37:33 2025 +0000 +++ b/buffer_get.c Fri Jan 31 15:26:11 2025 +0000 @@ -2,7 +2,7 @@ #include "byte.h" #include "error.h" -static int oneread(int (*op)(),int fd,char *buf,unsigned int len) +static int oneread(ssize_t (*op)(),int fd,char *buf,unsigned int len) { int r;
--- a/buffer_put.c Fri Jan 31 13:37:33 2025 +0000 +++ b/buffer_put.c Fri Jan 31 15:26:11 2025 +0000 @@ -3,7 +3,7 @@ #include "byte.h" #include "error.h" -static int allwrite(int (*op)(),int fd,char *buf,unsigned int len) +static int allwrite(ssize_t (*op)(),int fd,char *buf,unsigned int len) { int w;
--- a/cdbdump.c Fri Jan 31 13:37:33 2025 +0000 +++ b/cdbdump.c Fri Jan 31 15:26:11 2025 +0000 @@ -58,7 +58,7 @@ char strnum[FMT_ULONG]; -main() +int main() { uint32 eod; uint32 klen;
--- a/cdbget.c Fri Jan 31 13:37:33 2025 +0000 +++ b/cdbget.c Fri Jan 31 15:26:11 2025 +0000 @@ -23,7 +23,7 @@ static struct cdb c; char buf[1024]; -main(int argc,char **argv) +int main(int argc,char **argv) { char *key; int r;
--- a/cdbmake.c Fri Jan 31 13:37:33 2025 +0000 +++ b/cdbmake.c Fri Jan 31 15:26:11 2025 +0000 @@ -3,6 +3,7 @@ #include "strerr.h" #include "cdb_make.h" #include "cdb.h" +#include <stdio.h> #define FATAL "cdbmake: fatal: " @@ -36,7 +37,7 @@ static struct cdb_make c; -main(int argc,char **argv) +int main(int argc,char **argv) { unsigned int klen; unsigned int dlen;
--- a/cdbstats.c Fri Jan 31 13:37:33 2025 +0000 +++ b/cdbstats.c Fri Jan 31 15:26:11 2025 +0000 @@ -68,7 +68,7 @@ static unsigned long numrecords; static unsigned long numd[11]; -main() +int main() { uint32 eod; uint32 klen;
--- a/cdbtest.c Fri Jan 31 13:37:33 2025 +0000 +++ b/cdbtest.c Fri Jan 31 15:26:11 2025 +0000 @@ -66,7 +66,7 @@ static struct cdb c; -main() +int main() { uint32 eod; uint32 klen;
--- a/conf-cc.ac Fri Jan 31 13:37:33 2025 +0000 +++ b/conf-cc.ac Fri Jan 31 15:26:11 2025 +0000 @@ -1,4 +1,4 @@ -gcc CFLAGS -include /usr/include/errno.h -fPIC +gcc CFLAGS -include /usr/include/errno.h -fPIC -fdiagnostics-color=always This will be used to compile .c files. Replace CFLAGS with -O -ggdb for debugging, -O2 for production
--- a/conf-ld.ac Fri Jan 31 13:37:33 2025 +0000 +++ b/conf-ld.ac Fri Jan 31 15:26:11 2025 +0000 @@ -1,4 +1,4 @@ -gcc LDFLAGS +gcc LDFLAGS -fdiagnostics-color=always This will be used to link .o files into an executable. Remove LDFLAGS for debugging, replace with -s for production
--- a/install.c Fri Jan 31 13:37:33 2025 +0000 +++ b/install.c Fri Jan 31 15:26:11 2025 +0000 @@ -137,7 +137,7 @@ strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": "); } -main() +int main() { fdsourcedir = open_read("."); if (fdsourcedir == -1)
--- a/instcheck.c Fri Jan 31 13:37:33 2025 +0000 +++ b/instcheck.c Fri Jan 31 15:26:11 2025 +0000 @@ -101,7 +101,7 @@ perm("",home,"/",file,S_IFREG,uid,gid,mode); } -main() +int main() { hier(); _exit(0);
--- a/readwrite.h Fri Jan 31 13:37:33 2025 +0000 +++ b/readwrite.h Fri Jan 31 15:26:11 2025 +0000 @@ -1,7 +1,4 @@ -#ifndef READWRITE_H -#define READWRITE_H - -extern int read(); -extern int write(); +#ifndef _UNISTD_H +#include <unistd.h> #endif
--- a/seek.h Fri Jan 31 13:37:33 2025 +0000 +++ b/seek.h Fri Jan 31 15:26:11 2025 +0000 @@ -1,5 +1,7 @@ #ifndef SEEK_H #define SEEK_H +#include <sys/types.h> +#include <unistd.h> #include "uint32.h" typedef uint32 seek_pos;
--- a/testzero.c Fri Jan 31 13:37:33 2025 +0000 +++ b/testzero.c Fri Jan 31 15:26:11 2025 +0000 @@ -14,7 +14,7 @@ static char data[65536]; struct cdb_make c; -main(int argc,char **argv) +int main(int argc,char **argv) { int fd; unsigned long loop;
