diff options
| author | Tom Lane | 2008-06-18 20:55:42 +0000 |
|---|---|---|
| committer | Tom Lane | 2008-06-18 20:55:42 +0000 |
| commit | fbeb9da22be28c3252a1f704b028df0ecf1e3a0d (patch) | |
| tree | d516dcc20cc60d5cc8482e0e8813ba9ce4869b2e /src/include | |
| parent | 9de09c087d63b13b54a0db1073477d70188823c5 (diff) | |
Improve error reporting for problems in text search configuration files
by installing an error context subroutine that will provide the file name
and line number for all errors detected while reading a config file.
Some of the reader routines were already doing that in an ad-hoc way for
errors detected directly in the reader, but it didn't help for problems
detected in subroutines, such as encoding violations.
Back-patch to 8.3 because 8.3 is where people will be trying to debug
configuration files.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/tsearch/ts_locale.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/include/tsearch/ts_locale.h b/src/include/tsearch/ts_locale.h index 110efb191c1..b05ab7f1b0b 100644 --- a/src/include/tsearch/ts_locale.h +++ b/src/include/tsearch/ts_locale.h @@ -5,7 +5,7 @@ * * Copyright (c) 1998-2008, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/tsearch/ts_locale.h,v 1.7 2008/06/18 18:42:54 momjian Exp $ + * $PostgreSQL: pgsql/src/include/tsearch/ts_locale.h,v 1.8 2008/06/18 20:55:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,16 @@ #include <wctype.h> #endif +/* working state for tsearch_readline (should be a local var in caller) */ +typedef struct +{ + FILE *fp; + const char *filename; + int lineno; + char *curline; + ErrorContextCallback cb; +} tsearch_readline_state; + #define TOUCHAR(x) (*((const unsigned char *) (x))) #ifdef USE_WIDE_UPPER_LOWER @@ -55,6 +65,12 @@ extern int t_isprint(const char *ptr); extern char *lowerstr(const char *str); extern char *lowerstr_with_len(const char *str, int len); + +extern bool tsearch_readline_begin(tsearch_readline_state *stp, + const char *filename); +extern char *tsearch_readline(tsearch_readline_state *stp); +extern void tsearch_readline_end(tsearch_readline_state *stp); + extern char *t_readline(FILE *fp); #endif /* __TSLOCALE_H__ */ |
