1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- The __open_iob() function can be made simpler still.

git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14763 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2004-11-03 15:39:04 +00:00
parent 4dd74de299
commit 1ed26d0a60

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_openiob.c,v 1.2 2004-11-03 15:35:56 obarthel Exp $
* $Id: stdio_openiob.c,v 1.3 2004-11-03 15:39:04 obarthel Exp $
*
* :ts=4
*
@ -127,15 +127,6 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
SET_FLAG(open_mode,O_RDWR);
}
/* Figure out the buffered file access mode by looking at the open mode. */
file_flags = 0;
if(FLAG_IS_SET(open_mode,O_RDONLY) || FLAG_IS_SET(open_mode,O_RDWR))
SET_FLAG(file_flags,IOBF_READ);
if(FLAG_IS_SET(open_mode,O_WRONLY) || FLAG_IS_SET(open_mode,O_RDWR))
SET_FLAG(file_flags,IOBF_WRITE);
SHOWMSG("allocating file buffer");
/* Allocate a little more memory than necessary. */
@ -171,12 +162,21 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
CLEAR_FLAG(fd->fd_Flags,FDF_APPEND);
}
/* Figure out the buffered file access mode by looking at the open mode. */
file_flags = IOBF_IN_USE | IOBF_NO_NUL;
if(FLAG_IS_SET(open_mode,O_RDONLY) || FLAG_IS_SET(open_mode,O_RDWR))
SET_FLAG(file_flags,IOBF_READ);
if(FLAG_IS_SET(open_mode,O_WRONLY) || FLAG_IS_SET(open_mode,O_RDWR))
SET_FLAG(file_flags,IOBF_WRITE);
__initialize_iob(file,(HOOKFUNC)__iob_hook_entry,
buffer,
aligned_buffer,BUFSIZ,
file_descriptor,
slot_number,
IOBF_IN_USE | file_flags | IOBF_NO_NUL);
file_flags);
buffer = NULL;