src/server/config/mimeconf.c

changeset 385
a1f4cb076d2f
parent 255
b5d15a4a19f5
child 392
0aef555055ee
equal deleted inserted replaced
210:21274e5950af 385:a1f4cb076d2f
36 typedef struct { 36 typedef struct {
37 ucx_destructor destructor; 37 ucx_destructor destructor;
38 void *ptr; 38 void *ptr;
39 } ucx_regdestr; 39 } ucx_regdestr;
40 40
41 MimeConfig *load_mime_config(char *file) { 41 MimeConfig *load_mime_config(const char *file) {
42 FILE *in = fopen(file, "r"); 42 FILE *in = fopen(file, "r");
43 if(in == NULL) { 43 if(in == NULL) {
44 return NULL; 44 return NULL;
45 } 45 }
46 46
47 MimeConfig *conf = malloc(sizeof(MimeConfig)); 47 MimeConfig *conf = malloc(sizeof(MimeConfig));
48 conf->parser.parse = mimeconf_parse; 48 conf->parser.parse = mimeconf_parse;
49 conf->file = file;
50 conf->directives = NULL; 49 conf->directives = NULL;
51 conf->ntypes = 0; 50 conf->ntypes = 0;
52 int r = cfg_parse_basic_file((ConfigParser*)conf, in); 51 int r = cfg_parse_basic_file((ConfigParser*)conf, in);
53 if(r != 0) { 52 if(r != 0) {
54 fclose(in); 53 fclose(in);

mercurial