Changeset 5706

Remove unused cruft from config handling

Comitted by:  mjagdis
Date:  Jun 04 2010 * 23:10 (about 1 year ago)

Affected files:

callweaver/trunk/corelib/config.c (unified diff)

r5680r5706
9494
9595 #define MAX_INCLUDE_LEVEL 10
9696
97 struct cw_comment {
98 struct cw_comment *next;
99 char cmt[0];
100 };
101
10297 struct cw_category {
10398 char name[80];
10499 int ignored; /* do not let user of the config see this category */
------
119114 struct cw_variable *cw_variable_new(const char *name, const char *value)
120115 {
121116 struct cw_variable *variable;
117 int name_len, value_len, length;
122118
123 int length = strlen(name) + strlen(value) + 2 + sizeof(struct cw_variable);
124 variable = malloc(length);
125 if (variable) {
119 name_len = strlen(name) + 1;
120 value_len = strlen(value) + 1;
121 length = sizeof(struct cw_variable) + name_len + value_len;
122
123 if ((variable = malloc(length))) {
126124 memset(variable, 0, length);
127 variable->name = variable->stuff;
128 variable->value = variable->stuff + strlen(name) + 1;
129 strcpy(variable->name,name);
130 strcpy(variable->value,value);
125 variable->value = variable->name + name_len;
126 memcpy(variable->name, name, name_len);
127 memcpy(variable->value, value, value_len);
131128 }
132129
133130 return variable;
------
193190 {
194191 struct cw_variable *new = cw_variable_new(old->name, old->value);
195192
196 if (new) {
193 if (new)
197194 new->lineno = old->lineno;
198 new->object = old->object;
199 new->blanklines = old->blanklines;
200 /* TODO: clone comments? */
201 }
202195
203196 return new;
204197 }
------
390383 char *cur = buf;
391384 struct cw_variable *v;
392385 char cmd[512], exec_file[512];
393 int object, do_exec, do_include;
386 int do_exec, do_include;
394387
395388 /* Actually parse the entry */
396389 if (cur[0] == '[') {
------
524517 *c = 0;
525518 c++;
526519 /* Ignore > in => */
527 if (*c== '>') {
528 object = 1;
520 if (*c== '>')
529521 c++;
530 } else
531 object = 0;
532522 v = cw_variable_new(cw_strip(cur), cw_strip(c));
533523 if (v) {
534524 v->lineno = lineno;
535 v->object = object;
536525 /* Put and reset comments */
537 v->blanklines = 0;
538526 cw_variable_append(*cat, v);
539527 } else {
540528 cw_log(CW_LOG_WARNING, "Out of memory, line %d\n", lineno);

callweaver/trunk/include/callweaver/config.h (unified diff)

r5590r5706
3939 struct cw_category;
4040
4141 struct cw_variable {
42 char *name;
4342 char *value;
4443 int lineno;
45 int object; /*!< 0 for variable, 1 for object */
46 int blanklines; /*!< Number of blanklines following entry */
47 struct cw_comment *precomments;
48 struct cw_comment *sameline;
4944 struct cw_variable *next;
50 char stuff[0];
45 char name[0];
5146 };
5247
5348 typedef struct cw_config *config_load_func(const char *database, const char *table, const char *configfile, struct cw_config *config);