1010 * Written by Peter Eisentraut <peter_e@gmx.net>.
1111 *
1212 * IDENTIFICATION
13- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.438 2008/03/16 16:42:44 mha Exp $
13+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.439 2008/03/17 17:45:09 mha Exp $
1414 *
1515 *--------------------------------------------------------------------
1616 */
@@ -168,9 +168,6 @@ static const char *show_tcp_keepalives_count(void);
168168static bool assign_autovacuum_max_workers (int newval , bool doit , GucSource source );
169169static bool assign_maxconnections (int newval , bool doit , GucSource source );
170170
171- static const char * config_enum_lookup_value (struct config_enum * record , int val );
172- static bool config_enum_lookup_name (struct config_enum * record ,
173- const char * value , int * retval );
174171static char * config_enum_get_options (struct config_enum * record ,
175172 const char * prefix , const char * suffix );
176173
@@ -3144,7 +3141,7 @@ InitializeGUCOptions(void)
31443141 PGC_S_DEFAULT ))
31453142 elog (FATAL , "failed to initialize %s to %s" ,
31463143 conf -> gen .name ,
3147- config_enum_lookup_value (conf , conf -> boot_val ));
3144+ config_enum_lookup_by_value (conf , conf -> boot_val ));
31483145 * conf -> variable = conf -> reset_val = conf -> boot_val ;
31493146 break ;
31503147 }
@@ -4219,8 +4216,8 @@ parse_real(const char *value, double *result)
42194216 * The returned string is a pointer to static data and not
42204217 * allocated for modification.
42214218 */
4222- static const char *
4223- config_enum_lookup_value (struct config_enum * record , int val )
4219+ const char *
4220+ config_enum_lookup_by_value (struct config_enum * record , int val )
42244221{
42254222 const struct config_enum_entry * entry = record -> options ;
42264223 while (entry && entry -> name )
@@ -4242,8 +4239,8 @@ config_enum_lookup_value(struct config_enum *record, int val)
42424239 * true. If it's not found, return FALSE and retval is set to 0.
42434240 *
42444241 */
4245- static bool
4246- config_enum_lookup_name (struct config_enum * record , const char * value , int * retval )
4242+ bool
4243+ config_enum_lookup_by_name (struct config_enum * record , const char * value , int * retval )
42474244{
42484245 const struct config_enum_entry * entry = record -> options ;
42494246
@@ -4876,7 +4873,7 @@ set_config_option(const char *name, const char *value,
48764873
48774874 if (value )
48784875 {
4879- if (!config_enum_lookup_name (conf , value , & newval ))
4876+ if (!config_enum_lookup_by_name (conf , value , & newval ))
48804877 {
48814878 char * hintmsg = config_enum_get_options (conf , "Available values: " , "." );
48824879
@@ -4906,7 +4903,7 @@ set_config_option(const char *name, const char *value,
49064903 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
49074904 errmsg ("invalid value for parameter \"%s\": \"%s\"" ,
49084905 name ,
4909- config_enum_lookup_value (conf , newval ))));
4906+ config_enum_lookup_by_value (conf , newval ))));
49104907 return false;
49114908 }
49124909
@@ -5007,7 +5004,7 @@ GetConfigOption(const char *name)
50075004 return * ((struct config_string * ) record )-> variable ;
50085005
50095006 case PGC_ENUM :
5010- return config_enum_lookup_value ((struct config_enum * ) record ,
5007+ return config_enum_lookup_by_value ((struct config_enum * ) record ,
50115008 * ((struct config_enum * ) record )-> variable );
50125009 }
50135010 return NULL ;
@@ -5055,7 +5052,7 @@ GetConfigOptionResetString(const char *name)
50555052 return ((struct config_string * ) record )-> reset_val ;
50565053
50575054 case PGC_ENUM :
5058- return config_enum_lookup_value ((struct config_enum * ) record ,
5055+ return config_enum_lookup_by_value ((struct config_enum * ) record ,
50595056 ((struct config_enum * ) record )-> reset_val );
50605057 }
50615058 return NULL ;
@@ -6265,7 +6262,7 @@ _ShowOption(struct config_generic * record, bool use_units)
62656262 if (conf -> show_hook )
62666263 val = (* conf -> show_hook ) ();
62676264 else
6268- val = config_enum_lookup_value (conf , * conf -> variable );
6265+ val = config_enum_lookup_by_value (conf , * conf -> variable );
62696266 }
62706267 break ;
62716268
@@ -6331,7 +6328,7 @@ is_newvalue_equal(struct config_generic * record, const char *newvalue)
63316328 struct config_enum * conf = (struct config_enum * ) record ;
63326329 int newval ;
63336330
6334- return config_enum_lookup_name (conf , newvalue , & newval )
6331+ return config_enum_lookup_by_name (conf , newvalue , & newval )
63356332 && * conf -> variable == newval ;
63366333 }
63376334 }
@@ -6425,7 +6422,7 @@ write_nondefault_variables(GucContext context)
64256422 {
64266423 struct config_enum * conf = (struct config_enum * ) gconf ;
64276424
6428- fprintf (fp , "%s" , config_enum_lookup_value (conf , * conf -> variable ));
6425+ fprintf (fp , "%s" , config_enum_lookup_by_value (conf , * conf -> variable ));
64296426 }
64306427 break ;
64316428 }
0 commit comments