chiark / gitweb /
Update grapheme break algorithm to Unicode 5.1.0 (based on UAX #29)
[disorder] / lib / configuration.c
index 8ec79c76294771ae8027b76eca6beefc23b7095e..1fcfb1a6eefd138ef66aaba05dfa47438632c8da 100644 (file)
@@ -510,6 +510,7 @@ static void free_none(struct config attribute((unused)) *c,
 static void free_string(struct config *c,
                        const struct conf *whoami) {
   xfree(VALUE(c, char *));
+  VALUE(c, char *) = 0;
 }
 
 static void free_stringlist(struct config *c,
@@ -833,45 +834,6 @@ static int validate_alias(const struct config_state *cs,
   return 0;
 }
 
-static int validate_addrport(const struct config_state attribute((unused)) *cs,
-                            int nvec,
-                            char attribute((unused)) **vec) {
-  switch(nvec) {
-  case 0:
-    error(0, "%s:%d: missing address",
-         cs->path, cs->line);
-    return -1;
-  case 1:
-    error(0, "%s:%d: missing port name/number",
-         cs->path, cs->line);
-    return -1;
-  case 2:
-    return 0;
-  default:
-    error(0, "%s:%d: expected ADDRESS PORT",
-         cs->path, cs->line);
-    return -1;
-  }
-}
-
-static int validate_port(const struct config_state attribute((unused)) *cs,
-                        int nvec,
-                        char attribute((unused)) **vec) {
-  switch(nvec) {
-  case 0:
-    error(0, "%s:%d: missing address",
-         cs->path, cs->line);
-    return -1;
-  case 1:
-  case 2:
-    return 0;
-  default:
-    error(0, "%s:%d: expected [ADDRESS] PORT",
-         cs->path, cs->line);
-    return -1;
-  }
-}
-
 static int validate_algo(const struct config_state attribute((unused)) *cs,
                         int nvec,
                         char **vec) {
@@ -951,7 +913,7 @@ static const struct conf conf[] = {
   { C(checkpoint_kbyte), &type_integer,          validate_non_negative },
   { C(checkpoint_min),   &type_integer,          validate_non_negative },
   { C(collection),       &type_collections,      validate_any },
-  { C(connect),          &type_stringlist,       validate_addrport },
+  { C(connect),          &type_netaddress,       validate_destaddr },
   { C(cookie_login_lifetime),  &type_integer,    validate_positive },
   { C(cookie_key_lifetime),  &type_integer,      validate_positive },
   { C(dbversion),        &type_integer,          validate_positive },
@@ -960,7 +922,7 @@ static const struct conf conf[] = {
   { C(gap),              &type_integer,          validate_non_negative },
   { C(history),          &type_integer,          validate_positive },
   { C(home),             &type_string,           validate_isabspath },
-  { C(listen),           &type_stringlist,       validate_port },
+  { C(listen),           &type_netaddress,       validate_any },
   { C(lock),             &type_boolean,          validate_any },
   { C(mail_sender),      &type_string,           validate_any },
   { C(mixer),            &type_string,           validate_any },
@@ -1240,6 +1202,8 @@ static struct config *config_default(void) {
   }
   c->broadcast.af = -1;
   c->broadcast_from.af = -1;
+  c->listen.af = -1;
+  c->connect.af = -1;
   return c;
 }