diff options
Diffstat (limited to 'locale/programs')
-rw-r--r-- | locale/programs/linereader.c | 31 | ||||
-rw-r--r-- | locale/programs/linereader.h | 34 |
2 files changed, 34 insertions, 31 deletions
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 1df7df7e50..c3865e4dd5 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org>, 1996. @@ -111,6 +111,35 @@ lr_eof (struct linereader *lr) void +lr_ignore_rest (struct linereader *lr, int verbose) +{ + if (verbose) + { + while (isspace (lr->buf[lr->idx]) && lr->buf[lr->idx] != '\n' + && lr->buf[lr->idx] != lr->comment_char) + if (lr->buf[lr->idx] == '\0') + { + if (lr_next (lr) < 0) + return; + } + else + ++lr->idx; + + if (lr->buf[lr->idx] != '\n' && ! feof (lr->fp) + && lr->buf[lr->idx] != lr->comment_char) + lr_error (lr, _("trailing garbage at end of line")); + } + + /* Ignore continued line. */ + while (lr->bufact > 0 && lr->buf[lr->bufact - 1] != '\n') + if (lr_next (lr) < 0) + break; + + lr->idx = lr->bufact; +} + + +void lr_close (struct linereader *lr) { fclose (lr->fp); diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h index a44360979b..27043b2456 100644 --- a/locale/programs/linereader.h +++ b/locale/programs/linereader.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@gnu.org>. @@ -95,6 +95,7 @@ extern struct token *lr_token (struct linereader *lr, struct localedef_t *locale, const struct repertoire_t *repertoire, int verbose); +extern void lr_ignore_rest (struct linereader *lr, int verbose); #define lr_error(lr, fmt, args...) \ @@ -103,6 +104,7 @@ extern struct token *lr_token (struct linereader *lr, static inline int +__attribute ((always_inline)) lr_getc (struct linereader *lr) { if (lr->idx == lr->bufact) @@ -120,6 +122,7 @@ lr_getc (struct linereader *lr) static inline int +__attribute ((always_inline)) lr_ungetc (struct linereader *lr, int ch) { if (lr->idx == 0) @@ -142,33 +145,4 @@ lr_ungetn (struct linereader *lr, size_t n) } -static inline void -lr_ignore_rest (struct linereader *lr, int verbose) -{ - if (verbose) - { - while (isspace (lr->buf[lr->idx]) && lr->buf[lr->idx] != '\n' - && lr->buf[lr->idx] != lr->comment_char) - if (lr->buf[lr->idx] == '\0') - { - if (lr_next (lr) < 0) - return; - } - else - ++lr->idx; - - if (lr->buf[lr->idx] != '\n' && ! feof (lr->fp) - && lr->buf[lr->idx] != lr->comment_char) - lr_error (lr, _("trailing garbage at end of line")); - } - - /* Ignore continued line. */ - while (lr->bufact > 0 && lr->buf[lr->bufact - 1] != '\n') - if (lr_next (lr) < 0) - break; - - lr->idx = lr->bufact; -} - - #endif /* linereader.h */ |