From a264c280b95ead5d1a7ae52823381157a1f1d58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sun, 25 Sep 2022 13:07:49 +0800 Subject: handle_results is used only when strap is enabled --- configure.ac | 4 ++-- interchange.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 734bb99..319aee9 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,8 @@ LT_INIT AC_ARG_ENABLE([strap], [AS_HELP_STRING([--enable-strap], [enable Strap template parsing with libtidy])], - [PKG_CHECK_MODULES([TIDY], [tidy])], + [PKG_CHECK_MODULES([TIDY], [tidy]) + AC_DEFINE([ENABLE_STRAP])], [enable_strap=no]) AM_CONDITIONAL([STRAP], [test "x$enable_strap" = xyes]) AC_CANONICAL_HOST @@ -34,6 +35,5 @@ AC_FUNC_MALLOC AC_FUNC_REALLOC AC_TYPE_SIZE_T AC_TYPE_SSIZE_T -AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/interchange.c b/interchange.c index 66497b8..a8ba970 100644 --- a/interchange.c +++ b/interchange.c @@ -11,7 +11,9 @@ char *sampleurl; char *cainfo = NULL; #endif +#ifdef ENABLE_STRAP extern void handle_results(interchange_response *); +#endif void interchange_init(const char *url, const char *dir, const char *certificate) { @@ -42,7 +44,11 @@ void interchange_catalog(const char *prod_group, void (*handler)(interchange_res char *space = NULL; while ((space = strchr(nonspaced, ' '))) *space = '-'; +#ifdef ENABLE_STRAP request(handler ? handler : handle_results, (void (*)(void *))callback, NULL, "%s", nonspaced); +#else + request(handler, (void (*)(void *))callback, NULL, "%s", nonspaced); +#endif } void interchange_product(const char *sku, void (*handler)(interchange_response *), void (*callback)(struct interchange_product *)) -- cgit v1.2.3