-/* $OpenBSD: table.c,v 1.42 2018/12/27 14:23:41 eric Exp $ */
+/* $OpenBSD: table.c,v 1.43 2018/12/27 15:04:59 eric Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
if (table->t_backend->fetch == NULL)
return (-1);
- r = table->t_backend->fetch(table, kind, lk ? &buf : NULL);
+ r = table->t_backend->fetch(table, kind, &buf);
if (r == 1) {
- log_trace(TRACE_LOOKUP, "lookup: fetch %s from table %s:%s -> %s%s%s",
+ log_trace(TRACE_LOOKUP, "lookup: fetch %s from table %s:%s -> \"%s\"",
table_service_name(kind),
table->t_backend->name,
table->t_name,
- lk ? "\"" : "",
- (lk) ? buf : "found",
- lk ? "\"" : "");
- if (buf)
- r = table_parse_lookup(kind, NULL, buf, lk);
+ buf);
+ r = table_parse_lookup(kind, NULL, buf, lk);
}
else
log_trace(TRACE_LOOKUP, "lookup: fetch %s from table %s:%s -> %d",
-/* $OpenBSD: table_db.c,v 1.19 2018/12/27 14:41:45 eric Exp $ */
+/* $OpenBSD: table_db.c,v 1.20 2018/12/27 15:04:59 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
return 0;
}
- if (dst) {
- *dst = strdup(dbk.data);
- if (*dst == NULL)
- return -1;
- }
+ *dst = strdup(dbk.data);
+ if (*dst == NULL)
+ return -1;
return 1;
}
-/* $OpenBSD: table_static.c,v 1.28 2018/12/27 14:23:41 eric Exp $ */
+/* $OpenBSD: table_static.c,v 1.29 2018/12/27 15:04:59 eric Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
static int
table_static_fetch(struct table *t, enum table_service service, char **dst)
{
- const char *k;
+ const char *k;
if (!dict_iter(&t->t_dict, &t->t_iter, &k, (void **)NULL)) {
t->t_iter = NULL;
return 0;
}
- if (dst == NULL)
- return 1;
-
*dst = strdup(k);
if (*dst == NULL)
return -1;