CVS update: /ccvs/src/
[email protected] 26 May 2005 08:24:19 -0000
| Newsgroups | gmane.comp.version-control.cvs.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: conradpino Date: 05/05/26 01:24:19 Modified: /ccvs/src/ ChangeLog, buffer.c, buffer.h, socket-client.c Log: * buffer.c, buffer.h: Add & use typedefs for function pointer arguments and struct buffer function pointers. New typedefs are useful in casts. * socket-client.c: Function pointers passed to buf_initialize use size_t not int arguments. buf_initialize warnings are gone from Windows build. File Changes: Directory: /ccvs/src/ ===================== File [changed]: ChangeLog Url: https://ccvs.cvshome.org/source/browse/ccvs/src/ChangeLog?r1=1.3197&r2=1.3198 Delta lines: +7 -0 ------------------- --- ChangeLog 24 May 2005 20:59:01 -0000 1.3197 +++ ChangeLog 26 May 2005 08:24:17 -0000 1.3198 @@ -1,3 +1,10 @@ +2005-05-26 Conrad T. Pino <[email protected]> + + * buffer.c, buffer.h: Add & use typedefs for function pointer arguments + and struct buffer function pointers. New typedefs are useful in casts. + * socket-client.c: Function pointers passed to buf_initialize use size_t + not int arguments. buf_initialize warnings are gone from Windows build. + 2005-05-24 Derek Price <[email protected]> * client.c, entries.c, filesubr.c, hardlink.c, ignore.c, import.c, File [changed]: buffer.c Url: https://ccvs.cvshome.org/source/browse/ccvs/src/buffer.c?r1=1.57&r2=1.58 Delta lines: +8 -8 ------------------- --- buffer.c 17 Mar 2005 17:15:19 -0000 1.57 +++ buffer.c 26 May 2005 08:24:17 -0000 1.58 @@ -26,13 +26,13 @@ /* Initialize a buffer structure. */ struct buffer * -buf_initialize (int (*input) (void *, char *, size_t, size_t, size_t *), - int (*output) (void *, const char *, size_t, size_t *), - int (*flush) (void *), - int (*block) (void *, bool), - int (*get_fd) (void *), - int (*shutdown) (struct buffer *), - void (*memory) (struct buffer *), +buf_initialize (type_buf_input input, + type_buf_output output, + type_buf_flush flush, + type_buf_block block, + type_buf_get_fd get_fd, + type_buf_shutdown shutdown, + type_buf_memory_error memory_error, void *closure) { struct buffer *buf; @@ -47,7 +47,7 @@ buf->block = block; buf->get_fd = get_fd; buf->shutdown = shutdown; - buf->memory_error = memory ? memory : buf_default_memory_error; + buf->memory_error = memory_error ? memory_error : buf_default_memory_error; buf->closure = closure; return buf; } File [changed]: buffer.h Url: https://ccvs.cvshome.org/source/browse/ccvs/src/buffer.h?r1=1.23&r2=1.24 Delta lines: +25 -18 --------------------- --- buffer.h 8 Mar 2005 05:36:47 -0000 1.23 +++ buffer.h 26 May 2005 08:24:17 -0000 1.24 @@ -12,6 +12,16 @@ * list of buffer_data structures to hold data. */ +struct buffer; + +typedef int (*type_buf_input) (void *, char *, size_t, size_t, size_t *); +typedef int (*type_buf_output) (void *, const char *, size_t, size_t *); +typedef int (*type_buf_flush) (void *); +typedef int (*type_buf_block) (void *, bool); +typedef int (*type_buf_get_fd) (void *); +typedef int (*type_buf_shutdown) (struct buffer *); +typedef void (*type_buf_memory_error) (struct buffer *); + struct buffer { /* Data. */ @@ -37,30 +47,28 @@ If there are a nonzero number of bytes available, less than NEED, followed by end of file, just read those bytes and return 0. */ - int (*input) (void *closure, char *data, size_t need, size_t size, - size_t *got); + type_buf_input input; /* Write data. This should write up to HAVE bytes from DATA. This should return 0 on success, or an errno code. It should set the number of bytes written in *WROTE. */ - int (*output) (void *closure, const char *data, size_t have, - size_t *wrote); + type_buf_output output; /* Flush any data which may be buffered up after previous calls to OUTPUT. This should return 0 on success, or an errno code. */ - int (*flush) (void *closure); + type_buf_flush flush; /* Change the blocking mode of the underlying communication stream. If BLOCK is non-zero, it should be placed into blocking mode. Otherwise, it should be placed into non-blocking mode. This should return 0 on success, or an errno code. */ - int (*block) (void *closure, bool block); + type_buf_block block; /* Return the file descriptor underlying this buffer, if any, or -1 * otherwise. */ - int (*get_fd) (void *closure); + type_buf_get_fd get_fd; /* Shut down the communication stream. This does not mean that it should be closed. It merely means that no more data will be @@ -68,13 +76,13 @@ appropriate should be done at this point. This may be NULL. It should return 0 on success, or an errno code. This entry point exists for the compression code. */ - int (*shutdown) (struct buffer *); + type_buf_shutdown shutdown; /* This field is passed to the INPUT, OUTPUT, and BLOCK functions. */ void *closure; /* Function to call if we can't allocate memory. */ - void (*memory_error) (struct buffer *); + type_buf_memory_error memory_error; }; /* Data is stored in lists of these structures. */ @@ -106,14 +114,13 @@ /* The type of a function passed as a memory error handler. */ typedef void (*BUFMEMERRPROC) (struct buffer *); -struct buffer *buf_initialize (int (*) (void *, char *, size_t, size_t, - size_t *), - int (*) (void *, const char *, size_t, size_t *), - int (*) (void *), - int (*) (void *, bool), - int (*) (void *), - int (*) (struct buffer *), - void (*) (struct buffer *), +struct buffer *buf_initialize (type_buf_input, + type_buf_output, + type_buf_flush, + type_buf_block, + type_buf_get_fd, + type_buf_shutdown, + type_buf_memory_error, void *); void buf_free (struct buffer *); struct buffer *buf_nonio_initialize (void (*) (struct buffer *)); File [changed]: socket-client.c Url: https://ccvs.cvshome.org/source/browse/ccvs/src/socket-client.c?r1=1.14&r2=1.15 Delta lines: +4 -4 ------------------- --- socket-client.c 23 Oct 2004 16:52:32 -0000 1.14 +++ socket-client.c 26 May 2005 08:24:17 -0000 1.15 @@ -73,8 +73,8 @@ int socket; }; -static int socket_buffer_input (void *, char *, int, int, int *); -static int socket_buffer_output (void *, const char *, int, int *); +static int socket_buffer_input (void *, char *, size_t, size_t, size_t *); +static int socket_buffer_output (void *, const char *, size_t, size_t *); static int socket_buffer_flush (void *); static int socket_buffer_shutdown (struct buffer *); @@ -102,7 +102,7 @@ /* The buffer input function for a buffer built on a socket. */ static int -socket_buffer_input( void *closure, char *data, int need, int size, int *got ) +socket_buffer_input( void *closure, char *data, size_t need, size_t size, size_t *got ) { struct socket_buffer *sb = (struct socket_buffer *) closure; int nbytes; @@ -158,7 +158,7 @@ /* The buffer output function for a buffer built on a socket. */ static int -socket_buffer_output( void *closure, const char *data, int have, int *wrote ) +socket_buffer_output( void *closure, const char *data, size_t have, size_t *wrote ) { struct socket_buffer *sb = (struct socket_buffer *) closure;