- memset (&ud, 0, sizeof (ud));
- ud.data = st;
- ud.free_func = (void *) memcached_free;
+ ssnprintf (callback_name, sizeof (callback_name), "memcached/%s",
+ (st->name != NULL) ? st->name : "__legacy__");
+
+ /* If no <Address> used then:
+ * - Connect to the destination specified by <Host>, if present.
+ * If not, use the default address.
+ * - Use the default hostname (set st->host to NULL), if
+ * - Legacy mode is used (no configuration options at all), or
+ * - "Host" option is not provided, or
+ * - "Host" option is set to "localhost" or "127.0.0.1".
+ *
+ * If <Address> used then host may be set to "localhost" or "127.0.0.1"
+ * explicitly.
+ */
+ if (st->connhost == NULL)
+ {
+ if (st->host)
+ {
+ st->connhost = strdup(st->host);
+ if (st->connhost == NULL)
+ return (ENOMEM);