X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=blobdiff_plain;f=functions%2Fstdio%2F_PDCLIB_fvopen.c;h=4fc98ffe610fcc86845073d7bfa6e4964a73138b;hp=466009b04d070f069a28d1aa8899f57ff39f0cce;hb=0e35e82c5e9a0804864839e8fc0e985b1ae41f07;hpb=4fe88a1c445105a96d08b808831d6fc7480a211d diff --git a/functions/stdio/_PDCLIB_fvopen.c b/functions/stdio/_PDCLIB_fvopen.c index 466009b..4fc98ff 100644 --- a/functions/stdio/_PDCLIB_fvopen.c +++ b/functions/stdio/_PDCLIB_fvopen.c @@ -11,18 +11,21 @@ #ifndef REGTEST #include <_PDCLIB_glue.h> +#include <_PDCLIB_io.h> #include #include -extern struct _PDCLIB_file_t * _PDCLIB_filelist; +extern FILE * _PDCLIB_filelist; -struct _PDCLIB_file_t * _PDCLIB_fvopen( _PDCLIB_fd_t fd, - const _PDCLIB_fileops_t * ops, - int mode, - const char * _PDCLIB_restrict filename ) +FILE * _PDCLIB_fvopen( + _PDCLIB_fd_t fd, + const _PDCLIB_fileops_t *_PDCLIB_restrict ops, + int mode, + const char *_PDCLIB_restrict filename +) { size_t filename_len; - struct _PDCLIB_file_t * rc; + FILE * rc; if ( mode == NULL ) { /* Mode invalid */ @@ -36,7 +39,7 @@ struct _PDCLIB_file_t * _PDCLIB_fvopen( _PDCLIB_fd_t fd, Data buffer comes last because it might change in size ( setvbuf() ). */ filename_len = filename ? strlen( filename ) + 1 : 1; - if ( ( rc = calloc( 1, sizeof( struct _PDCLIB_file_t ) + _PDCLIB_UNGETCBUFSIZE + filename_len + BUFSIZ ) ) == NULL ) + if ( ( rc = calloc( 1, sizeof( FILE ) + _PDCLIB_UNGETCBUFSIZE + filename_len + BUFSIZ ) ) == NULL ) { /* no memory */ return NULL; @@ -51,7 +54,7 @@ struct _PDCLIB_file_t * _PDCLIB_fvopen( _PDCLIB_fd_t fd, rc->ops = ops; rc->handle = fd; /* Setting pointers into the memory block allocated above */ - rc->ungetbuf = (unsigned char *)rc + sizeof( struct _PDCLIB_file_t ); + rc->ungetbuf = (unsigned char *)rc + sizeof( FILE ); rc->filename = (char *)rc->ungetbuf + _PDCLIB_UNGETCBUFSIZE; rc->buffer = rc->filename + filename_len; /* Copying filename to FILE structure */