conf: added "used" flag to struct block_param
This commit is contained in:
		@@ -139,6 +139,7 @@ config_new_param(const char *value, int line)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ret->num_block_params = 0;
 | 
						ret->num_block_params = 0;
 | 
				
			||||||
	ret->block_params = NULL;
 | 
						ret->block_params = NULL;
 | 
				
			||||||
 | 
						ret->used = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -210,6 +211,7 @@ config_add_block_param(struct config_param * param, const char *name,
 | 
				
			|||||||
	bp->name = g_strdup(name);
 | 
						bp->name = g_strdup(name);
 | 
				
			||||||
	bp->value = g_strdup(value);
 | 
						bp->value = g_strdup(value);
 | 
				
			||||||
	bp->line = line;
 | 
						bp->line = line;
 | 
				
			||||||
 | 
						bp->used = false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct config_param *
 | 
					static struct config_param *
 | 
				
			||||||
@@ -356,7 +358,7 @@ config_get_next_param(const char *name, const struct config_param * last)
 | 
				
			|||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	param = node->data;
 | 
						param = node->data;
 | 
				
			||||||
 | 
						param->used = true;
 | 
				
			||||||
	return param;
 | 
						return param;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -418,6 +420,7 @@ config_get_block_param(const struct config_param * param, const char *name)
 | 
				
			|||||||
	for (unsigned i = 0; i < param->num_block_params; i++) {
 | 
						for (unsigned i = 0; i < param->num_block_params; i++) {
 | 
				
			||||||
		if (0 == strcmp(name, param->block_params[i].name)) {
 | 
							if (0 == strcmp(name, param->block_params[i].name)) {
 | 
				
			||||||
			struct block_param *bp = ¶m->block_params[i];
 | 
								struct block_param *bp = ¶m->block_params[i];
 | 
				
			||||||
 | 
								bp->used = true;
 | 
				
			||||||
			return bp;
 | 
								return bp;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								src/conf.h
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/conf.h
									
									
									
									
									
								
							@@ -75,6 +75,12 @@ struct block_param {
 | 
				
			|||||||
	char *name;
 | 
						char *name;
 | 
				
			||||||
	char *value;
 | 
						char *value;
 | 
				
			||||||
	int line;
 | 
						int line;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * This flag is false when nobody has queried the value of
 | 
				
			||||||
 | 
						 * this option yet.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						bool used;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct config_param {
 | 
					struct config_param {
 | 
				
			||||||
@@ -83,6 +89,12 @@ struct config_param {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	struct block_param *block_params;
 | 
						struct block_param *block_params;
 | 
				
			||||||
	unsigned num_block_params;
 | 
						unsigned num_block_params;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * This flag is false when nobody has queried the value of
 | 
				
			||||||
 | 
						 * this option yet.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						bool used;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void config_global_init(void);
 | 
					void config_global_init(void);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user