conf: added config_add_param()
The function config_add_param() allows adding new configuration parameters.
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/conf.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/conf.c
									
									
									
									
									
								
							@@ -23,6 +23,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <glib.h>
 | 
					#include <glib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
@@ -349,6 +350,15 @@ void config_read_file(const char *file)
 | 
				
			|||||||
	fclose(fp);
 | 
						fclose(fp);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					config_add_param(const char *name, struct config_param *param)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct config_entry *entry = config_entry_get(name);
 | 
				
			||||||
 | 
						assert(entry != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						entry->params = g_slist_append(entry->params, param);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct config_param *
 | 
					struct config_param *
 | 
				
			||||||
config_get_next_param(const char *name, const struct config_param * last)
 | 
					config_get_next_param(const char *name, const struct config_param * last)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,6 +91,13 @@ void config_global_finish(void);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void config_read_file(const char *file);
 | 
					void config_read_file(const char *file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Adds a new configuration parameter.  The name must be registered
 | 
				
			||||||
 | 
					 * with registerConfigParam().
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					config_add_param(const char *name, struct config_param *param);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* don't free the returned value
 | 
					/* don't free the returned value
 | 
				
			||||||
   set _last_ to NULL to get first entry */
 | 
					   set _last_ to NULL to get first entry */
 | 
				
			||||||
struct config_param *
 | 
					struct config_param *
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user