4
4
*
5
5
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
6
6
*
7
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.41 2006/08/12 04:11:50 momjian Exp $
7
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.42 2006/08/12 04:12:41 momjian Exp $
8
8
*/
9
9
10
10
%{
@@ -50,8 +50,7 @@ int GUC_yylex(void);
50
50
static bool ParseConfigFile (const char *config_file, const char *calling_file,
51
51
int depth, GucContext context, int elevel,
52
52
struct name_value_pair **head_p,
53
- struct name_value_pair **tail_p,
54
- int *varcount);
53
+ struct name_value_pair **tail_p);
55
54
static void free_name_value_list (struct name_value_pair * list);
56
55
static char *GUC_scanstr (const char *s);
57
56
@@ -115,10 +114,8 @@ STRING \'([^'\\\n]|\\.|\'\')*\'
115
114
void
116
115
ProcessConfigFile(GucContext context)
117
116
{
118
- int elevel, i ;
117
+ int elevel;
119
118
struct name_value_pair *item, *head, *tail;
120
- bool *apply_list = NULL;
121
- int varcount = 0;
122
119
123
120
Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);
124
121
@@ -137,56 +134,25 @@ ProcessConfigFile(GucContext context)
137
134
138
135
if (!ParseConfigFile(ConfigFileName, NULL,
139
136
0, context, elevel,
140
- &head, &tail, &varcount ))
137
+ &head, &tail))
141
138
goto cleanup_list;
142
139
143
- /* Can we allocate memory here, what about leaving here prematurely? */
144
- apply_list = (bool *) palloc(sizeof(bool) * varcount);
145
-
146
140
/* Check if all options are valid */
147
- for (item = head, i = 0 ; item; item = item->next, i++ )
141
+ for (item = head; item; item = item->next)
148
142
{
149
- bool isEqual, isContextOk;
150
-
151
- if (!verify_config_option(item->name, item->value, context,
152
- PGC_S_FILE, &isEqual, &isContextOk))
153
- {
154
- ereport(elevel,
155
- (errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
156
- errmsg("configuration file is invalid")));
143
+ if (!set_config_option(item->name, item->value, context,
144
+ PGC_S_FILE, false, false))
157
145
goto cleanup_list;
158
- }
159
-
160
- if( isContextOk == false )
161
- {
162
- apply_list[i] = false;
163
- if( context == PGC_SIGHUP )
164
- {
165
- if ( isEqual == false )
166
- ereport(elevel,
167
- (errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
168
- errmsg("parameter \" %s\" cannot be changed after server start; configuration file change ignored",
169
- item->name)));
170
- }
171
- else
172
- /* if it is boot phase, context must be valid for all
173
- * configuration item. */
174
- goto cleanup_list;
175
- }
176
- else
177
- apply_list[i] = true;
178
146
}
179
147
180
148
/* If we got here all the options checked out okay, so apply them. */
181
- for (item = head, i = 0 ; item; item = item->next, i++ )
182
- if (apply_list[i])
183
- set_config_option(item->name, item->value, context,
184
- PGC_S_FILE, false, true);
185
-
149
+ for (item = head; item; item = item->next)
150
+ {
151
+ set_config_option(item->name, item->value, context,
152
+ PGC_S_FILE, false, true);
153
+ }
186
154
187
- cleanup_list:
188
- if (apply_list)
189
- pfree(apply_list);
155
+ cleanup_list:
190
156
free_name_value_list(head);
191
157
}
192
158
@@ -223,14 +189,13 @@ static bool
223
189
ParseConfigFile (const char *config_file, const char *calling_file,
224
190
int depth, GucContext context, int elevel,
225
191
struct name_value_pair **head_p,
226
- struct name_value_pair **tail_p,
227
- int *varcount)
192
+ struct name_value_pair **tail_p)
228
193
{
229
- bool OK = true ;
230
- char abs_path[MAXPGPATH];
231
- FILE *fp;
194
+ bool OK = true ;
195
+ char abs_path[MAXPGPATH];
196
+ FILE *fp;
232
197
YY_BUFFER_STATE lex_buffer;
233
- int token;
198
+ int token;
234
199
235
200
/*
236
201
* Reject too-deep include nesting depth. This is just a safety check
@@ -324,7 +289,7 @@ ParseConfigFile(const char *config_file, const char *calling_file,
324
289
325
290
if (!ParseConfigFile (opt_value, config_file,
326
291
depth + 1 , context, elevel,
327
- head_p, tail_p, varcount ))
292
+ head_p, tail_p))
328
293
{
329
294
pfree (opt_name);
330
295
pfree (opt_value);
@@ -368,7 +333,6 @@ ParseConfigFile(const char *config_file, const char *calling_file,
368
333
else
369
334
(*tail_p)->next = item;
370
335
*tail_p = item;
371
- (*varcount)++;
372
336
}
373
337
374
338
/* break out of loop if read EOF, else loop for next line */
0 commit comments