From b4d83d2e6ae0ec475371ca0fd400e72edc539710 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sat, 24 Jan 2009 13:58:35 +0100 Subject: Move linked list structs for pipe_{bytes,lines} into these functions --- inotail.c | 13 +++++++++++-- inotail.h | 15 --------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/inotail.c b/inotail.c index 670d9fe..877a96d 100644 --- a/inotail.c +++ b/inotail.c @@ -289,7 +289,12 @@ static int tail_pipe_from_begin(struct file_struct *f, unsigned long n_units, co static int tail_pipe_lines(struct file_struct *f, unsigned long n_lines) { - struct line_buf *first, *last, *tmp; + struct line_buf { + char buf[BUFSIZ]; + size_t n_lines; + size_t n_bytes; + struct line_buf *next; + } *first, *last, *tmp; int rc; unsigned long total_lines = 0; const char *p; @@ -404,7 +409,11 @@ out: /* TODO: Merge some parts (especially buffer handling) with tail_pipe_lines() */ static int tail_pipe_bytes(struct file_struct *f, unsigned long n_bytes) { - struct char_buf *first, *last, *tmp; + struct char_buf { + char buf[BUFSIZ]; + size_t n_bytes; + struct char_buf *next; + } *first, *last, *tmp; int rc; unsigned long total_bytes = 0; unsigned long i = 0; /* Index into buffer */ diff --git a/inotail.h b/inotail.h index 93011e6..3d6c232 100644 --- a/inotail.h +++ b/inotail.h @@ -28,21 +28,6 @@ struct file_struct { int i_watch; /* Inotify watch associated with file_struct */ }; -/* struct for linked list of buffers/lines in tail_pipe_lines */ -struct line_buf { - char buf[BUFSIZ]; - size_t n_lines; - size_t n_bytes; - struct line_buf *next; -}; - -/* struct for linked list of byte buffers in tail_pipe_bytes */ -struct char_buf { - char buf[BUFSIZ]; - size_t n_bytes; - struct char_buf *next; -}; - #define IS_PIPELIKE(mode) \ (S_ISFIFO(mode) || S_ISSOCK(mode)) -- cgit v1.2.3-54-g00ecf