Mail Archives: djgpp-workers/2001/02/23/05:07:15
> From: "Mark E." <snowball3 AT bigfoot DOT com>
> Date: Thu, 22 Feb 2001 22:52:10 -0500
>
> Revision two of O_TEMPORARY support is ready for inspection.
Thanks! Apart of a few minor comments below, I think this can go in.
> I have tested this the following small program:
Perhaps you could add this test program to djtstNNN.zip.
> + typedef struct fd_properties fd_properties;
> +
> + typedef struct fd_properties
> + {
> + unsigned char ref_count;
> + unsigned long flags;
> + char *filename;
> + fd_properties *prev;
> + fd_properties *next;
> + };
Shouldn't the second typedef simply be "struct fd_properties", without
"typedef"?
> + /* Find another properties object using the same filename. */
> + static
> + fd_properties * find_eq_filename(const fd_properties *fd)
> + {
> + fd_properties *ptr = active_fds;
> +
> + while (ptr)
> + {
> + if ((ptr != fd) && (strcmp(fd->filename, ptr->filename) == 0))
> + return ptr;
> + ptr = ptr->next;
> + }
> + return NULL;
> + }
I wonder whether we should use stricmp here. Yes, I know: _truename
canonicalizes the letter case, but you know... paranoia...
(If you do change this, don't forget to #include <libc/stubs.h>.)
> + */ static fd_properties * alloc_fd_properties() {
> + fd_properties *ptr;
This is not according to the braces and indentatioin style.
> + static void free_fd_properties(fd_properties *fd) {
> + remove_1ist(&active_fds, fd);
> + insert_1ist(&cached_fds, fd);
> + }
Same here.
> *************** open(const char* filename, int oflag, ..
> *** 152,157 ****
> --- 153,161 ----
> if(oflag & O_APPEND)
> lseek(fd, 0, SEEK_END);
>
> + if (oflag)
> + _set_fd_properties(fd, real_name, oflag);
> +
Isn't it better to put this into _open instead of open? The opposite
operation is inside _close, not close.
Finally, the docs part is missing.
- Raw text -