}
/* check whether value for $dsn_notify would be valid */
-static int check_dsn_notify (const char* option __attribute__ ((unused)), unsigned long p,
- char* errbuf, ssize_t errlen) {
- list2_t* list = NULL;
- ssize_t i = 0;
- int rc = 1;
- char* val = (char*) p;
-
- if (!val || !*val)
- return (1);
- list = list_from_str (val, ",");
- if (list_empty (list))
- return (1);
+static int
+check_dsn_notify (const char* option __attribute__ ((unused)),
+ unsigned long val, char* errbuf, ssize_t errlen)
+{
+ const char *p = (const char*)val;
+
+ while (*p) {
+ const char *q = m_strchrnul(p, ',');
+ int len = q - p;
+
+ if (!m_strncmp(p, "never", len) && !m_strncmp(p, "delay", len)
+ && !m_strncmp(p, "failure", len) && !m_strncmp(p, "success", len))
+ {
+ if (errbuf)
+ snprintf(errbuf, errlen, _("'%.*s' is invalid for $%s"),
+ len, p, "dsn_notify");
+ return 0;
+ }
- for (i = 0; i < list->length; i++)
- if (m_strncmp(list->data[i], "never", 5) != 0 &&
- m_strncmp(list->data[i], "failure", 7) != 0 &&
- m_strncmp(list->data[i], "delay", 5) != 0 &&
- m_strncmp(list->data[i], "success", 7) != 0) {
- if (errbuf)
- snprintf (errbuf, errlen, _("'%s' is invalid for $%s"),
- (char*) list->data[i], "dsn_notify");
- rc = 0;
- break;
+ p = q + 1;
}
- list_del (&list, (list_del_t*)xmemfree);
- return (rc);
+
+ return 1;
}
static int check_num (const char* option, unsigned long p,